コード例 #1
0
ファイル: MallController.cs プロジェクト: NH4CL/UniProject
 /// <summary>
 /// 保存新增或者编辑的禁用IP地址
 /// </summary>
 /// <param name="mallDisableIP"></param>
 /// <returns></returns>
 public string DisableIPSave(MallDisabledIp mallDisableIP)
 {
     string strIP = mallDisableIP.IpAddress;
     var oMallDisableIP = (from o in dbEntity.MallDisabledIps where (o.OrgID == gOrgId && o.ChlID == gChlId) select o).ToList();
     foreach (var item in oMallDisableIP)
     {
         if (item.IpAddress==strIP&&item.Deleted==false)
         {
             return "ERROR";
         }
         else if (item.IpAddress == strIP && item.Deleted == true)
         {
             item.Deleted = false;
             dbEntity.SaveChanges();
             return "Success";
         }
     }
     MallDisabledIp oDisableIP = new MallDisabledIp();
     oDisableIP.OrgID = gOrgId;
     oDisableIP.ChlID = gChlId;
     oDisableIP.IpAddress = mallDisableIP.IpAddress;
     oDisableIP.Remark = mallDisableIP.Remark;
     dbEntity.MallDisabledIps.Add(oDisableIP);
     dbEntity.SaveChanges();
     return "Success";
 }
コード例 #2
0
ファイル: MallController.cs プロジェクト: NH4CL/UniProject
        public ActionResult DisableIPAddOrEdit(Guid? id)
        {
            MallDisabledIp oMallDisableIP = new MallDisabledIp();
            //添加新的禁用IP
            if (id == null)
            {
                oMallDisableIP.OrgID = gOrgId;
                MemberOrganization oMemberOrganization = (from o in dbEntity.MemberOrganizations where (o.Gid == gOrgId && o.Deleted == false) select o).Single();
                oMallDisableIP.Organization = oMemberOrganization;

                oMallDisableIP.ChlID = gChlId;
                MemberChannel oMemberChannel = (from o in dbEntity.MemberChannels where (o.Gid == gChlId && o.Deleted == false) select o).Single();
                oMallDisableIP.Channel = oMemberChannel;

                List<SelectListItem> StatusList = GetSelectList(oMallDisableIP.GenericStatusList);
                ViewBag.StatusList=StatusList;
            }
            else
            {
                oMallDisableIP = (from o in dbEntity.MallDisabledIps where (o.Gid == id && o.Deleted == false) select o).Single();
                List<SelectListItem> StatusList = GetSelectList(oMallDisableIP.GenericStatusList);
                ViewBag.StatusList = StatusList;
            }
            return View("DisableIPAddOrEdit",oMallDisableIP);
        }