コード例 #1
0
 private void CreateSINBINZone()
 {
     try
     {
         if (General.GetQueryable <Gen_Zone>(c => c.ZoneName == "SIN BIN").Count() == 0)
         {
             ZoneBO objZone = new ZoneBO();
             objZone.New();
             objZone.Current.ZoneName    = "SIN BIN";
             objZone.Current.ShortName   = "SIN BIN";
             objZone.Current.AddOn       = DateTime.Now;
             objZone.Current.AddBy       = AppVars.LoginObj.LuserId.ToInt();
             objZone.Current.OrderNo     = 1000;
             objZone.Current.ZoneTypeId  = 1;
             objZone.Current.PlotKind    = 1;
             objZone.CheckDataValidation = false;
             objZone.Save();
         }
     }
     catch
     {
     }
 }
コード例 #2
0
        public override void Save()
        {
            try
            {
                if (objMaster.PrimaryKeyValue == null)
                {
                    objMaster.New();
                }
                else
                {
                    objMaster.Edit();
                }

                objMaster.Current.ZoneName = txtZoneName.Text.Trim();
                objMaster.Current.PostCode = string.Join(",", grdPostCodes.Rows.Select(c => c.Cells[COLS.PostCode].Value.ToStr()).ToArray <string>());


                objMaster.Current.IsBase     = chkBase.Checked;
                objMaster.Current.ShortName  = txtShortName.Text.Trim();
                objMaster.Current.ZoneTypeId = ddlType.SelectedValue.ToIntorNull();

                objMaster.Current.PlotKind = ddlKind.SelectedValue.ToIntorNull();

                string[] skipProperties = new string[] { "Gen_Zones" };


                int orderNo = 1;
                IList <Gen_Zone_AssociatedPostCode> savedList    = objMaster.Current.Gen_Zone_AssociatedPostCodes;
                List <Gen_Zone_AssociatedPostCode>  listofDetail = (from r in grdPostCodes.Rows
                                                                    //where r.Cells[COL_DOCUMENT.FILENAME].Value.ToStr()!=string.Empty
                                                                    select new Gen_Zone_AssociatedPostCode
                {
                    Id = r.Cells[COLS.Id].Value.ToInt(),
                    ZoneId = r.Cells[COLS.MasterId].Value.ToInt(),
                    AreaName = objMaster.Current.ZoneName,
                    PostCode = r.Cells[COLS.PostCode].Value.ToStr().Trim(),
                    OrderNo = orderNo++
                }).ToList();


                Utils.General.SyncChildCollection(ref savedList, ref listofDetail, "Id", skipProperties);


                objMaster.Save();

                General.LoadZoneList();

                //      PDAClass.SaveZone(objMaster.Current);
            }
            catch (Exception ex)
            {
                if (objMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }