public ActionResult New(IssueAddress issueAddress)
 {
     if (!string.IsNullOrWhiteSpace(issueAddress.ParentIssueAddressCode))
     {
         ViewBag.ParentIssueAddressCode = issueAddress.ParentIssueAddressCode;
         var parent = base.genericMgr.FindById<IssueAddress>(issueAddress.ParentIssueAddressCode);
         IssueAddress parentIssueAddress = new IssueAddress();//base.genericMgr.FindById<IssueType>(issueTypeTo.IssueTypeCode);
         parentIssueAddress.Code = issueAddress.ParentIssueAddressCode;
         issueAddress.ParentIssueAddress = parentIssueAddress;
         ModelState.Remove("ParentIssueAddress");
     }
     if (ModelState.IsValid)
     {
         //判断用户名不能重复
         if (base.genericMgr.FindAll<long>(codeDuiplicateVerifyStatement, new object[] { issueAddress.Code })[0] > 0)
         {
             base.SaveErrorMessage(Resources.ISS.IssueAddress.Errors_Existing_IssueAddress, issueAddress.Code);
         }
         else
         {
             base.genericMgr.Create(issueAddress);
             SaveSuccessMessage(Resources.ISS.IssueAddress.IssueAddress_Added);
             return RedirectToAction("Edit/" + issueAddress.Code);
         }
     }
     return View(issueAddress);
 }
        public ActionResult Edit(IssueAddress issueAddress)
        {
            if (!string.IsNullOrWhiteSpace(issueAddress.ParentIssueAddressCode))
            {
                ViewBag.ParentIssueAddressId = issueAddress.ParentIssueAddressCode;
                var parent = base.genericMgr.FindById<IssueAddress>(issueAddress.ParentIssueAddressCode);
                if (parent.ParentIssueAddressCode == issueAddress.Code)
                {
                    SaveErrorMessage("地点{0}已经是地点{1}的上级地点,请确认。", issueAddress.Code, issueAddress.ParentIssueAddressCode);
                    return View(issueAddress);
                }
                IssueAddress parentIssueAddress = new IssueAddress();//base.genericMgr.FindById<IssueType>(issueTypeTo.IssueTypeCode);
                parentIssueAddress.Code = issueAddress.ParentIssueAddressCode;
                issueAddress.ParentIssueAddress = parentIssueAddress;
                ModelState.Remove("ParentIssueAddress");
            }
            if (ModelState.IsValid)
            {
                base.genericMgr.Update(issueAddress);
                SaveSuccessMessage(Resources.ISS.IssueAddress.IssueAddress_Updated);
            }

            return View(issueAddress);
        }
        public ActionResult _IssueAddressComboBox(string controlName, string controlId, string selectedValue)
        {
            ViewBag.ControlName = controlName;
            ViewBag.ControlId = controlId;
            ViewBag.SelectedValue = selectedValue;
            IList<IssueAddress> issueAddressList = new List<IssueAddress>();

            if (selectedValue != null && selectedValue.Trim() != string.Empty)
            {
                issueAddressList = base.genericMgr.FindAll<IssueAddress>(selectEqIssueAddressStatement, new object[] { selectedValue, selectedValue });
                if (issueAddressList.Count == 0)
                {
                    IssueAddress ia = new IssueAddress();
                    ia.Code = selectedValue;
                    issueAddressList.Add(ia);
                    return PartialView(new SelectList(issueAddressList, "Code", "CodeDescription", selectedValue));

                }
            }

            return PartialView(new SelectList(issueAddressList, "Code", "CodeDescription", selectedValue));

        }
        public ActionResult Edit(IssueAddress issueAddress)
        {
            if (!string.IsNullOrWhiteSpace(issueAddress.ParentIssueAddressCode))
            {
                ViewBag.ParentIssueAddressId = issueAddress.ParentIssueAddressCode;
                IssueAddress parentIssueAddress = new IssueAddress();//this.genericMgr.FindById<IssueType>(issueTypeTo.IssueTypeCode);
                parentIssueAddress.Code = issueAddress.ParentIssueAddressCode;
                issueAddress.ParentIssueAddress = parentIssueAddress;
                ModelState.Remove("ParentIssueAddress");
            }
            if (ModelState.IsValid)
            {
                genericMgr.UpdateWithTrim(issueAddress);
                SaveSuccessMessage(Resources.ISS.IssueAddress.IssueAddress_Updated);
            }

            return View(issueAddress);
        }
        public ActionResult _IssueAddressDropDownList(string code, string controlName, string controlId, string selectedValue, bool? includeBlankOption, bool? enable)
        {
            ViewBag.ControlName = controlName;
            ViewBag.ControlId = controlId;
            //ViewBag.SelectedValue = selectedValue;
            ViewBag.Enable = enable;
            string hql = " from IssueAddress as ia ";
            if (!string.IsNullOrEmpty(code))
            {
                hql += "where ia.Code !='" + code + "'";
            }

            IList<IssueAddress> issueAddressList = base.genericMgr.FindAll<IssueAddress>(hql);

            if (issueAddressList == null)
            {
                issueAddressList = new List<IssueAddress>();
            }

            if (includeBlankOption.HasValue && includeBlankOption.Value)
            {
                IssueAddress blankIssueAddress = new IssueAddress();
                issueAddressList.Insert(0, blankIssueAddress);
            }
            return PartialView(new SelectList(issueAddressList, "Code", "CodeDescription", selectedValue));
        }