コード例 #1
0
ファイル: NameCorrection.cs プロジェクト: dmziryanov/ApecAuto
partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (var dc = new TecdocStoreDataContext())
                {
                    if (dc.NameCorrections.SingleOrDefault(
                         m => m.OriginalName == OriginalName) != null)
                        throw new ValidationException("это значение уже есть в списке");
                }
            }
        }
コード例 #2
0
partial         void OnValidate(ChangeAction action)
        {
            if (action == ChangeAction.Insert)
            {
                using (var dc = new TecdocStoreDataContext())
                {
                    if (dc.CountryVisibilities.SingleOrDefault(
                         c => c.CountryID == CountryID) != null)
                        throw new ValidationException("эта страна уже есть в списке видимых");
                }
            }
            if (HttpContext.Current.Cache["visibleCountries"] != null)
                HttpContext.Current.Cache.Remove("visibleCountries");
        }
コード例 #3
0
ファイル: NameCorrection.cs プロジェクト: dmziryanov/ApecAuto
partial         void OnCorrectedNameChanged()
        {
            string query = "";
            NameCorrection record;

            using (var dc = new TecdocStoreDataContext())
            {
                record = dc.NameCorrections.SingleOrDefault(n => n.NameCorrectionID == Convert.ToInt32(HttpContext.Current.Request["NameCorrectionID"]));
            }

            switch (record.TableName)
            {
                case "tecdoc_tof_manufacturers":
                    query = "update tecdoc_tof_manufacturers set mfa_brand = '" + _CorrectedName + "' where mfa_id = " + record.ID;
                    break;
                case "tecdoc_tof_models":
                    query =
                        "update t set t.tex_text = '" + _CorrectedName +
                        @"' from tecdoc_tof_des_texts t
                            join tecdoc_tof_country_designations cd on cd.cds_tex_id = t.tex_id
                            join tecdoc_tof_models m on m.mod_cds_id = cd.cds_id
                            where m.mod_id = " +
                        record.ID;
                    break;
            }

            if (query != "")
                using (SqlConnection conn = new SqlConnection(global::RmsAuto.TechDoc.Properties.Settings.Default.ex_tecdocsConnectionString))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection = conn;
                        cmd.CommandText = query;
                        cmd.ExecuteNonQuery();
                    }
                }
        }
コード例 #4
0
ファイル: List.aspx.cs プロジェクト: dmziryanov/ApecAuto
 protected void Page_Init(object sender, EventArgs e)
 {
     _context = new TecdocStoreDataContext();
     _context.DeferredLoadingEnabled = false;
 }