Esempio n. 1
0
 /// <summary>
 /// 组织详细介绍页面.Html编辑器
 /// </summary>
 /// <param name="OrgType">页面传递的标志位,组织类型</param>
 /// <param name="Gid">组织的Gid</param>
 /// <returns></returns>
 public ActionResult OrgIntroduction(string OrgType, Guid Gid)
 {
     OrganizationBase oOrganizationModel = new OrganizationBase();
     ViewBag.OrgType = OrgType;
     switch (OrgType)//不同的组织类型
     {
         case "organization": oOrganizationModel = dbEntity.MemberOrganizations.Include("FullName").Include("ShortName").Include("Parent").Where(o => o.Gid == Gid).FirstOrDefault();
             if (oOrganizationModel.aIntroduction != null)
                 oOrganizationModel.Introduction = RefreshLargeObject(oOrganizationModel.Introduction, Gid);
             else
                 oOrganizationModel.Introduction = NewLargeObject(Gid);
             break;
         case "channel": oOrganizationModel = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
             if (oOrganizationModel.aIntroduction != null)
                 oOrganizationModel.Introduction = RefreshLargeObject(oOrganizationModel.Introduction);
             else
                 oOrganizationModel.Introduction = NewLargeObject();
             break;
         case "warehouse": oOrganizationModel = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
             if (oOrganizationModel.aIntroduction != null)
                 oOrganizationModel.Introduction = RefreshLargeObject(oOrganizationModel.Introduction, oOrganizationModel.aParent);
             else
                 oOrganizationModel.Introduction = NewLargeObject(oOrganizationModel.aParent);
             break;
         case "supplier": oOrganizationModel = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
             if (oOrganizationModel.aIntroduction != null)
                 oOrganizationModel.Introduction = RefreshLargeObject(oOrganizationModel.Introduction, oOrganizationModel.aParent);
             else
                 oOrganizationModel.Introduction = NewLargeObject(oOrganizationModel.aParent);
             break;
         case "shipper": oOrganizationModel = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
             if (oOrganizationModel.aIntroduction != null)
                 oOrganizationModel.Introduction = RefreshLargeObject(oOrganizationModel.Introduction, oOrganizationModel.aParent);
             else
                 oOrganizationModel.Introduction = NewLargeObject(oOrganizationModel.aParent);
             break;
     }
     try//由于节点的编辑功能代码都是EnableEdit 因此可以放在此处做验证权限,若代码不同,则需要单独对某种CASE做权限判断
     {
         ViewBag.privEnableEdit = CurrentSession.IsAdmin ? "1" : oProgramNodes["EnableEdit"];
     }
     catch (KeyNotFoundException)//捕捉到oProgramNodes没有Key 说明没有授权该节点
     {
         ViewBag.privEnableEdit = "0";
     }
     return View(oOrganizationModel);
 }
Esempio n. 2
0
 public string saveOrgIntroduction(OrganizationBase oBackModel)
 {
     if (!base.CheckPrivilege("EnableEdit"))//权限验证
         return "NoPrivilege";
     if (oBackModel.Gid != Guid.Empty)//编辑保存
     {
         OrganizationBase oOldOrganization = new OrganizationBase();
         switch (oBackModel.Otype)
         {
             case 0: oOldOrganization = dbEntity.MemberOrganizations.Include("FullName").Include("ShortName").Where(o => o.Gid == oBackModel.Gid).FirstOrDefault();
                 if (oOldOrganization.aIntroduction != null)
                     oOldOrganization.Introduction = RefreshLargeObject(oOldOrganization.Introduction, oOldOrganization.Gid);
                 else
                     oOldOrganization.Introduction = NewLargeObject(oOldOrganization.Gid);
                 break;
             case 1: oOldOrganization = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault();
                 if (oOldOrganization.aIntroduction != null)
                     oOldOrganization.Introduction = RefreshLargeObject(oOldOrganization.Introduction);
                 else
                     oOldOrganization.Introduction = NewLargeObject();
                 break;
             case 2: oOldOrganization = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault();
                 if (oOldOrganization.aIntroduction != null)
                     oOldOrganization.Introduction = RefreshLargeObject(oOldOrganization.Introduction, oOldOrganization.aParent);
                 else
                     oOldOrganization.Introduction = NewLargeObject(oOldOrganization.aParent);
                 break;
             case 3: oOldOrganization = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault();
                 if (oOldOrganization.aIntroduction != null)
                     oOldOrganization.Introduction = RefreshLargeObject(oOldOrganization.Introduction, oOldOrganization.aParent);
                 else
                     oOldOrganization.Introduction = NewLargeObject(oOldOrganization.aParent);
                 break;
             case 4: oOldOrganization = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault();
                 if (oOldOrganization.aIntroduction != null)
                     oOldOrganization.Introduction = RefreshLargeObject(oOldOrganization.Introduction, oOldOrganization.aParent);
                 else
                     oOldOrganization.Introduction = NewLargeObject(oOldOrganization.aParent);
                 break;
         }
         oOldOrganization.Introduction = oBackModel.Introduction;
     }
     dbEntity.SaveChanges();
     return "Success";
 }
Esempio n. 3
0
        /// <summary>
        /// 添加和编辑组织
        /// </summary>
        /// <returns></returns>
        public ActionResult OrgDetail(string OrgType, Guid? Gid, Guid? ParentOrgID)
        {
            // 权限验证
            if (!base.CheckPrivilege("EnableEdit"))
                RedirectToAction("ErrorPage", "Home", new { message = "Sorry you have no privilege to visit the Page" });
            //初始化组织
            OrganizationBase oOrganizationModel = new OrganizationBase { FullName = NewResource(ModelEnum.ResourceType.STRING, ParentOrgID), ShortName = NewResource(ModelEnum.ResourceType.STRING, ParentOrgID) };
            ViewBag.OrgType = OrgType;//用于页面控制
            if (ParentOrgID != null)
            {
                ViewBag.ParentName = dbEntity.MemberOrganizations.Where(o => o.Gid == ParentOrgID && o.Deleted == false).FirstOrDefault().FullName.GetResource(CurrentSession.Culture);
                oOrganizationModel.aParent = ParentOrgID;
            }
            else
                ViewBag.ParentName = "";
            //扩展类型下拉框
            List<GeneralStandardCategory> ExTypeList = new List<GeneralStandardCategory>();
            if (Gid != null || OrgType == "organization")//是编辑该组织
            {
                switch (OrgType)
                {
                    case "organization": Gid = gOrgId;
                        oOrganizationModel = dbEntity.MemberOrganizations.Include("FullName").Include("ShortName").Include("Parent").Where(o => o.Gid == Gid).FirstOrDefault();
                        oOrganizationModel.FullName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.FullName, oOrganizationModel.Gid);
                        oOrganizationModel.ShortName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.ShortName, oOrganizationModel.Gid);
                        ExTypeList = dbEntity.GeneralStandardCategorys.Include("Name").Where(c => c.Ctype == (byte)ModelEnum.StandardCategoryType.ORGANIZATION).ToList();
                        break;
                    case "channel": oOrganizationModel = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
                        oOrganizationModel.FullName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.FullName);
                        oOrganizationModel.ShortName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.ShortName);
                        ExTypeList = dbEntity.GeneralStandardCategorys.Include("Name").Where(c => c.Ctype == (byte)ModelEnum.StandardCategoryType.CHANNEL).ToList();
                        break;
                    case "warehouse": oOrganizationModel = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
                        oOrganizationModel.FullName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.FullName, oOrganizationModel.Parent.Gid);
                        oOrganizationModel.ShortName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.ShortName, oOrganizationModel.Parent.Gid);
                        break;
                    case "supplier": oOrganizationModel = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
                        oOrganizationModel.FullName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.FullName, oOrganizationModel.Parent.Gid);
                        oOrganizationModel.ShortName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.ShortName, oOrganizationModel.Parent.Gid);
                        break;
                    case "shipper": oOrganizationModel = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(o => o.Gid == Gid).FirstOrDefault();
                        oOrganizationModel.FullName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.FullName, oOrganizationModel.Parent.Gid);
                        oOrganizationModel.ShortName = RefreshResource(ModelEnum.ResourceType.STRING, oOrganizationModel.ShortName, oOrganizationModel.Parent.Gid);
                        break;
                }
                ViewBag.IsAdding = false;
            }
            else//添加组织
            {
                switch (OrgType)
                {
                    case "organization": oOrganizationModel.Otype = (byte)ModelEnum.OrganizationType.CORPORATION;
                        ExTypeList = dbEntity.GeneralStandardCategorys.Include("Name").Where(c => c.Ctype == (byte)ModelEnum.StandardCategoryType.ORGANIZATION).ToList();
                        break;
                    case "channel": oOrganizationModel.Otype = (byte)ModelEnum.OrganizationType.CHANNEL;
                        ExTypeList = dbEntity.GeneralStandardCategorys.Include("Name").Where(c => c.Ctype == (byte)ModelEnum.StandardCategoryType.CHANNEL).ToList();
                        break;
                    case "warehouse": oOrganizationModel.Otype = (byte)ModelEnum.OrganizationType.WAREHOUSE; break;
                    case "supplier": oOrganizationModel.Otype = (byte)ModelEnum.OrganizationType.SUPPLIER; break;
                    case "shipper": oOrganizationModel.Otype = (byte)ModelEnum.OrganizationType.SHIPPER; break;
                }
                ViewBag.IsAdding = true;
            }
            //生成“状态”下拉框
            List<SelectListItem> organizationstatuslist = GetSelectList(oOrganizationModel.OrganStatusList);
            ViewBag.organizationstatuslist = organizationstatuslist;
            //生成“类型”下拉框
            List<SelectListItem> organizationtypelist = GetSelectList(oOrganizationModel.OrganTypeList);
            ViewBag.organizationtypelist = organizationtypelist;
            //扩展类型下拉框
            List<SelectListItem> lExType = new List<SelectListItem>();
            lExType.Add(new SelectListItem { Text = null, Value = null });
            for (int i = 0; i < ExTypeList.Count; i++)
            {
                lExType.Add(new SelectListItem { Text = ExTypeList.ElementAt(i).Name.GetResource(CurrentSession.Culture), Value = ExTypeList.ElementAt(i).Gid.ToString() });
            }
            ViewBag.lExType = lExType;
            //是否是末级
            List<SelectListItem> IsTerminal = SelectEnumList(false);
            ViewBag.oIsTerminal = IsTerminal;

            return View(oOrganizationModel);
        }
Esempio n. 4
0
 /// <summary>
 /// 保存组织
 /// </summary>
 /// <param name="oOrganization"></param>
 public void SaveEditOrgDetail(OrganizationBase oBackModel)
 {
     if (oBackModel.Gid != Guid.Empty)//编辑保存
     {
         OrganizationBase oOldOrganization = new OrganizationBase { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) };
         switch (oBackModel.Otype)
         {
             case 0: oOldOrganization = dbEntity.MemberOrganizations.Include("FullName").Include("ShortName").Where(o => o.Gid == oBackModel.Gid).FirstOrDefault(); break;
             case 1: oOldOrganization = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break;
             case 2: oOldOrganization = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break;
             case 3: oOldOrganization = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break;
             case 4: oOldOrganization = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break;
         }
         oOldOrganization.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
         oOldOrganization.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
         oOldOrganization.Code = oBackModel.Code;
         oOldOrganization.ExCode = oBackModel.ExCode;
         oOldOrganization.Ostatus = oBackModel.Ostatus;
         oOldOrganization.Otype = oBackModel.Otype;
         oOldOrganization.ExType = oBackModel.ExType;
         oOldOrganization.Terminal = oBackModel.Terminal;
         oOldOrganization.aLocation = oBackModel.aLocation;
         oOldOrganization.FullAddress = oBackModel.FullAddress;
         oOldOrganization.PostCode = oBackModel.PostCode;
         oOldOrganization.Contact = oBackModel.Contact;
         oOldOrganization.CellPhone = oBackModel.CellPhone;
         oOldOrganization.WorkPhone = oBackModel.WorkPhone;
         oOldOrganization.WorkFax = oBackModel.WorkFax;
         oOldOrganization.Email = oBackModel.Email;
         oOldOrganization.HomeUrl = oBackModel.HomeUrl;
         oOldOrganization.Sorting = oBackModel.Sorting;
         oOldOrganization.Brief = oBackModel.Brief;
         oOldOrganization.Remark = oBackModel.Remark;
     }
     else//添加保存
     {
         switch (oBackModel.Otype)
         {
             case 0: break;
             case 1: MemberChannel oNewMemberChannel = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(o => o.Code == oBackModel.Code).FirstOrDefault();
                 if (oNewMemberChannel != null)//原来存在,则是编辑
                 {
                     oNewMemberChannel.Deleted = false;
                     oNewMemberChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewMemberChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     //oNewMemberChannel.Code = oBackModel.Code;
                     oNewMemberChannel.ExCode = oBackModel.ExCode;
                     oNewMemberChannel.Ostatus = oBackModel.Ostatus;
                     //oNewMemberChannel.Otype = oBackModel.Otype;
                     oNewMemberChannel.ExType = oBackModel.ExType;
                     oNewMemberChannel.Terminal = oBackModel.Terminal;
                     oNewMemberChannel.aLocation = oBackModel.aLocation;
                     oNewMemberChannel.FullAddress = oBackModel.FullAddress;
                     oNewMemberChannel.PostCode = oBackModel.PostCode;
                     oNewMemberChannel.Contact = oBackModel.Contact;
                     oNewMemberChannel.CellPhone = oBackModel.CellPhone;
                     oNewMemberChannel.WorkPhone = oBackModel.WorkPhone;
                     oNewMemberChannel.WorkFax = oBackModel.WorkFax;
                     oNewMemberChannel.Email = oBackModel.Email;
                     oNewMemberChannel.HomeUrl = oBackModel.HomeUrl;
                     oNewMemberChannel.Sorting = oBackModel.Sorting;
                     oNewMemberChannel.Brief = oBackModel.Brief;
                     oNewMemberChannel.Remark = oBackModel.Remark;
                 }
                 else
                 {
                     oNewMemberChannel = new MemberChannel { FullName = NewResource(ModelEnum.ResourceType.STRING), ShortName = NewResource(ModelEnum.ResourceType.STRING) };
                     oNewMemberChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewMemberChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     oNewMemberChannel.Code = oBackModel.Code;
                     oNewMemberChannel.ExCode = oBackModel.ExCode;
                     oNewMemberChannel.Ostatus = oBackModel.Ostatus;
                     oNewMemberChannel.Otype = oBackModel.Otype;
                     oNewMemberChannel.ExType = oBackModel.ExType;
                     oNewMemberChannel.Terminal = oBackModel.Terminal;
                     oNewMemberChannel.aLocation = oBackModel.aLocation;
                     oNewMemberChannel.FullAddress = oBackModel.FullAddress;
                     oNewMemberChannel.PostCode = oBackModel.PostCode;
                     oNewMemberChannel.Contact = oBackModel.Contact;
                     oNewMemberChannel.CellPhone = oBackModel.CellPhone;
                     oNewMemberChannel.WorkPhone = oBackModel.WorkPhone;
                     oNewMemberChannel.WorkFax = oBackModel.WorkFax;
                     oNewMemberChannel.Email = oBackModel.Email;
                     oNewMemberChannel.HomeUrl = oBackModel.HomeUrl;
                     oNewMemberChannel.Sorting = oBackModel.Sorting;
                     oNewMemberChannel.Brief = oBackModel.Brief;
                     oNewMemberChannel.Remark = oBackModel.Remark;
                     dbEntity.MemberChannels.Add(oNewMemberChannel);
                 }
                 break;
             case 2: WarehouseInformation oNewWarehouse = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(w => w.Code == oBackModel.Code).FirstOrDefault();
                 if (oNewWarehouse != null)
                 {
                     oNewWarehouse.Deleted = false;
                     oNewWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     //oNewWarehouse.aParent = oBackModel.aParent;
                     //oNewWarehouse.Code = oBackModel.Code;
                     oNewWarehouse.ExCode = oBackModel.ExCode;
                     oNewWarehouse.Ostatus = oBackModel.Ostatus;
                     //oNewWarehouse.Otype = oBackModel.Otype;
                     oNewWarehouse.ExType = oBackModel.ExType;
                     oNewWarehouse.Terminal = oBackModel.Terminal;
                     oNewWarehouse.aLocation = oBackModel.aLocation;
                     oNewWarehouse.FullAddress = oBackModel.FullAddress;
                     oNewWarehouse.PostCode = oBackModel.PostCode;
                     oNewWarehouse.Contact = oBackModel.Contact;
                     oNewWarehouse.CellPhone = oBackModel.CellPhone;
                     oNewWarehouse.WorkPhone = oBackModel.WorkPhone;
                     oNewWarehouse.WorkFax = oBackModel.WorkFax;
                     oNewWarehouse.Email = oBackModel.Email;
                     oNewWarehouse.HomeUrl = oBackModel.HomeUrl;
                     oNewWarehouse.Sorting = oBackModel.Sorting;
                     oNewWarehouse.Brief = oBackModel.Brief;
                     oNewWarehouse.Remark = oBackModel.Remark;
                 }
                 else
                 {
                     oNewWarehouse = new WarehouseInformation { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) };
                     oNewWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     oNewWarehouse.aParent = oBackModel.aParent;
                     oNewWarehouse.Code = oBackModel.Code;
                     oNewWarehouse.ExCode = oBackModel.ExCode;
                     oNewWarehouse.Ostatus = oBackModel.Ostatus;
                     oNewWarehouse.Otype = oBackModel.Otype;
                     oNewWarehouse.ExType = oBackModel.ExType;
                     oNewWarehouse.Terminal = oBackModel.Terminal;
                     oNewWarehouse.aLocation = oBackModel.aLocation;
                     oNewWarehouse.FullAddress = oBackModel.FullAddress;
                     oNewWarehouse.PostCode = oBackModel.PostCode;
                     oNewWarehouse.Contact = oBackModel.Contact;
                     oNewWarehouse.CellPhone = oBackModel.CellPhone;
                     oNewWarehouse.WorkPhone = oBackModel.WorkPhone;
                     oNewWarehouse.WorkFax = oBackModel.WorkFax;
                     oNewWarehouse.Email = oBackModel.Email;
                     oNewWarehouse.HomeUrl = oBackModel.HomeUrl;
                     oNewWarehouse.Sorting = oBackModel.Sorting;
                     oNewWarehouse.Brief = oBackModel.Brief;
                     oNewWarehouse.Remark = oBackModel.Remark;
                     dbEntity.WarehouseInformations.Add(oNewWarehouse);
                 }
                 break;
             case 3: PurchaseSupplier oNewPurchaseSupplier = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(s => s.Code == oBackModel.Code).FirstOrDefault();
                 if (oNewPurchaseSupplier != null)
                 {
                     oNewPurchaseSupplier.Deleted = false;
                     oNewPurchaseSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewPurchaseSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     //oNewPurchaseSupplier.aParent = oBackModel.aParent;
                     //oNewPurchaseSupplier.Code = oBackModel.Code;
                     oNewPurchaseSupplier.ExCode = oBackModel.ExCode;
                     oNewPurchaseSupplier.Ostatus = oBackModel.Ostatus;
                     //oNewPurchaseSupplier.Otype = oBackModel.Otype;
                     oNewPurchaseSupplier.ExType = oBackModel.ExType;
                     oNewPurchaseSupplier.Terminal = oBackModel.Terminal;
                     oNewPurchaseSupplier.aLocation = oBackModel.aLocation;
                     oNewPurchaseSupplier.FullAddress = oBackModel.FullAddress;
                     oNewPurchaseSupplier.PostCode = oBackModel.PostCode;
                     oNewPurchaseSupplier.Contact = oBackModel.Contact;
                     oNewPurchaseSupplier.CellPhone = oBackModel.CellPhone;
                     oNewPurchaseSupplier.WorkPhone = oBackModel.WorkPhone;
                     oNewPurchaseSupplier.WorkFax = oBackModel.WorkFax;
                     oNewPurchaseSupplier.Email = oBackModel.Email;
                     oNewPurchaseSupplier.HomeUrl = oBackModel.HomeUrl;
                     oNewPurchaseSupplier.Sorting = oBackModel.Sorting;
                     oNewPurchaseSupplier.Brief = oBackModel.Brief;
                     oNewPurchaseSupplier.Remark = oBackModel.Remark;
                 }
                 else
                 {
                     oNewPurchaseSupplier = new PurchaseSupplier { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) };
                     oNewPurchaseSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewPurchaseSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     oNewPurchaseSupplier.aParent = oBackModel.aParent;
                     oNewPurchaseSupplier.Code = oBackModel.Code;
                     oNewPurchaseSupplier.ExCode = oBackModel.ExCode;
                     oNewPurchaseSupplier.Ostatus = oBackModel.Ostatus;
                     oNewPurchaseSupplier.Otype = oBackModel.Otype;
                     oNewPurchaseSupplier.ExType = oBackModel.ExType;
                     oNewPurchaseSupplier.Terminal = oBackModel.Terminal;
                     oNewPurchaseSupplier.aLocation = oBackModel.aLocation;
                     oNewPurchaseSupplier.FullAddress = oBackModel.FullAddress;
                     oNewPurchaseSupplier.PostCode = oBackModel.PostCode;
                     oNewPurchaseSupplier.Contact = oBackModel.Contact;
                     oNewPurchaseSupplier.CellPhone = oBackModel.CellPhone;
                     oNewPurchaseSupplier.WorkPhone = oBackModel.WorkPhone;
                     oNewPurchaseSupplier.WorkFax = oBackModel.WorkFax;
                     oNewPurchaseSupplier.Email = oBackModel.Email;
                     oNewPurchaseSupplier.HomeUrl = oBackModel.HomeUrl;
                     oNewPurchaseSupplier.Sorting = oBackModel.Sorting;
                     oNewPurchaseSupplier.Brief = oBackModel.Brief;
                     oNewPurchaseSupplier.Remark = oBackModel.Remark;
                     dbEntity.PurchaseSuppliers.Add(oNewPurchaseSupplier);
                 }
                 break;
             case 4: ShippingInformation oNewShippingInformations = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(s => s.Code == oBackModel.Code).FirstOrDefault();
                 if (oNewShippingInformations != null)
                 {
                     oNewShippingInformations.Deleted = false;
                     oNewShippingInformations.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewShippingInformations.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     //oNewShippingInformations.aParent = oBackModel.aParent;
                     //oNewShippingInformations.Code = oBackModel.Code;
                     oNewShippingInformations.ExCode = oBackModel.ExCode;
                     oNewShippingInformations.Ostatus = oBackModel.Ostatus;
                     //oNewShippingInformations.Otype = oBackModel.Otype;
                     oNewShippingInformations.ExType = oBackModel.ExType;
                     oNewShippingInformations.Terminal = oBackModel.Terminal;
                     oNewShippingInformations.aLocation = oBackModel.aLocation;
                     oNewShippingInformations.FullAddress = oBackModel.FullAddress;
                     oNewShippingInformations.PostCode = oBackModel.PostCode;
                     oNewShippingInformations.Contact = oBackModel.Contact;
                     oNewShippingInformations.CellPhone = oBackModel.CellPhone;
                     oNewShippingInformations.WorkPhone = oBackModel.WorkPhone;
                     oNewShippingInformations.WorkFax = oBackModel.WorkFax;
                     oNewShippingInformations.Email = oBackModel.Email;
                     oNewShippingInformations.HomeUrl = oBackModel.HomeUrl;
                     oNewShippingInformations.Sorting = oBackModel.Sorting;
                     oNewShippingInformations.Brief = oBackModel.Brief;
                     oNewShippingInformations.Remark = oBackModel.Remark;
                 }
                 else
                 {
                     oNewShippingInformations = new ShippingInformation { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) };
                     oNewShippingInformations.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName);
                     oNewShippingInformations.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName);
                     oNewShippingInformations.aParent = oBackModel.aParent;
                     oNewShippingInformations.Code = oBackModel.Code;
                     oNewShippingInformations.ExCode = oBackModel.ExCode;
                     oNewShippingInformations.Ostatus = oBackModel.Ostatus;
                     oNewShippingInformations.Otype = oBackModel.Otype;
                     oNewShippingInformations.ExType = oBackModel.ExType;
                     oNewShippingInformations.Terminal = oBackModel.Terminal;
                     oNewShippingInformations.aLocation = oBackModel.aLocation;
                     oNewShippingInformations.FullAddress = oBackModel.FullAddress;
                     oNewShippingInformations.PostCode = oBackModel.PostCode;
                     oNewShippingInformations.Contact = oBackModel.Contact;
                     oNewShippingInformations.CellPhone = oBackModel.CellPhone;
                     oNewShippingInformations.WorkPhone = oBackModel.WorkPhone;
                     oNewShippingInformations.WorkFax = oBackModel.WorkFax;
                     oNewShippingInformations.Email = oBackModel.Email;
                     oNewShippingInformations.HomeUrl = oBackModel.HomeUrl;
                     oNewShippingInformations.Sorting = oBackModel.Sorting;
                     oNewShippingInformations.Brief = oBackModel.Brief;
                     oNewShippingInformations.Remark = oBackModel.Remark;
                     dbEntity.ShippingInformations.Add(oNewShippingInformations);
                 }
                 break;
         }
     }
     dbEntity.SaveChanges();
 }