Monday, March 5, 2012

My same web.config file for mvc3 with razor + entityframework

<?xml version="1.0" encoding="utf-8"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=152368
  -->
<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <connectionStrings>
    <add name="AICms1DbContext"
         connectionString="MultipleActiveResultSets=True;Data Source=HOMEWORK;Initial Catalog=AICms1Db;User ID=sa;Password=********;Pooling=false"
         providerName="System.Data.SqlClient" />
  </connectionStrings>
  <appSettings>
    <add key="webpages:Version" value="1.0.0.0" />
    <add key="ClientValidationEnabled" value="true" />
    <add key="UnobtrusiveJavaScriptEnabled" value="true" />
  </appSettings>
  <system.web>
    <customErrors mode="Off" />
    <authentication mode="Forms">
      <forms timeout="10080" /><!--7day-->
    </authentication>
    <httpRuntime maxRequestLength="134217728" /><!--128mb-->
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      </assemblies>
    </compilation>
    <!--<authentication mode="Forms">
      <forms loginUrl="~/Account/LogOn" timeout="2880" />
    </authentication>-->
    <membership defaultProvider="AspNetSqlMembershipProvider" hashAlgorithmType="SHA1">
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="AICms1DbContext" applicationName="/" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" />
      </providers>
    </membership>
    <profile inherits="HiimelOyun.Web.Cms1.Models.UserProfile" defaultProvider="AspNetSqlProfileProvider">
      <providers>
        <clear />
        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="AICms1DbContext" applicationName="/" />
      </providers>
    </profile>
    <roleManager enabled="true" defaultProvider="AspNetSqlRoleProvider">
      <providers>
        <clear />
        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="AICms1DbContext" applicationName="/" />
        <!--<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />-->
      </providers>
    </roleManager>
    <pages validateRequest="false">
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
      </namespaces>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
        <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=True" />
      </parameters>
    </defaultConnectionFactory>
  </entityFramework>
</configuration>

Дундаж өртөг тооцох жишээ

1-p odor --- 0 uldegdel
5*100+3*120=8*107.5=860 orlogo
7*125=875 zarlaga
15 ashig
1 toollogo+

2-p odor --- 1 uldegdel
2*100=200 orlogo
3*125=375 zarlaga
175 ashig
0 toollogo

1-p sar --- 0 uldegdel
7*100+3*120=10*106=1060 orlogo
10*125=1250 zarlaga
190 ashig
0 toollogo

Filter Extensions in HTML form upload

<input type='file' name='userFile'>


now when i will click the browse button, the browse dialog will show all files... what if i want to filter file types lets say
  • only images or .png & .jpg & .gifs
  • only office file like .doc & .docx & .pps
 
 
 
$(function() {
    $('#inputId').change( function() {
        var filename = $(this).val();
        if ( ! /\.txt$/.test(filename)) {
            alert('Please select a text file');
        }
    });
});
 
 
<input type="file" accept="image/*" />
 
 
 
 
 
 
<form enctype="multipart/form-data" action="uploader.php" method="POST">
Upload DRP File:<input name="Upload Saved Replay" type="file" accept="*.drp"/><br />
<input type="submit" value="Upload File" />
</form>
 

Saturday, March 3, 2012

Mongolian postal code list

Coding method

post code in Mongolia consist of 5 digits.
15141
the first digit=region / zone (for the capital)
the second digit=province / district (for the capital)
the last three digits=locality/delivery block (for the capital)


Address format

Mr. Temuujin Dashnyam
6-r horoolol-2, Hudaldaanii gudamj-52/4
Apart-30-29
ULAANBAATAR, 15141
MONGOLIA

more post code

Eastern region :





Central region :













Khangain region :











Western region :










Dornod
Sukhbaatar
Khentii

Tuv
Govi-Sumber
Selenge
Dornogovi
Darkhan-Uul
Omnogovi
Dundgovi

Orkhon
Ovorkhangai
Bulgan
Bayankhongor
Arkhangai
Khovsgol

Zavkhan
Govi-Altai
Bayan-Olgii
Khovd
Uvs
21xxx
22xxx
23xxx

41xxx
42xxx
43xxx
44xxx
45xxx
46xxx
48xxx

61xxx
62xxx
63xxx
64xxx
65xxx
67xxx

81xxx
82xxx
83xxx
84xxx
85xxx