Example #1
0
        public ActionResult New(Picker picker)
        {
            if (ModelState.IsValid)
            {
                if (base.genericMgr.FindAll<long>(duiplicateVerifyStatement, new object[] { picker.Code, picker.UserCode })[0] > 0)
                {
                    SaveErrorMessage(Resources.MD.Picker.PickerErrors_Existing_CodeAndUserCode, picker.Code, picker.UserCode);
                }
                else
                {
                    IList<User> users = base.genericMgr.FindAll<User>(getUser, picker.UserCode);
                    if (users != null && users.Count > 0)
                    {
                        picker.UserNm = users[0].Name;
                        base.genericMgr.Create(picker);
                        SaveSuccessMessage(Resources.MD.Picker.Picker_Added);
                        return RedirectToAction("Edit/" + picker.Id);
                    }

                    SaveErrorMessage(Resources.ErrorMessage.Errors_Common_FieldValueNotExist, Resources.MD.Picker.Picker_UserCode, picker.UserCode);
                }
            }

            return View(picker);
        }
Example #2
0
        public ActionResult _AjaxLoadingPickerWithBlank(string item, string location, string text)
        {
            IList<Picker> pickerList = new List<Picker>();

            IList<PickRule> pickRule = base.genericMgr.FindAll<PickRule>("from PickRule where Item = ? and Location = ?",
                new object[] { item, location });
            if (pickRule != null && pickRule.Count > 0)
            {
                foreach (PickRule rule in pickRule)
                {
                    Picker p = base.genericMgr.FindAll<Picker>("from Picker where Code = ? and IsActive = ?", new object[] { rule.Picker, true }).SingleOrDefault();
                    if (p != null)
                    {
                        pickerList.Add(p);
                    }
                }

                Picker blankPicker = new Picker();
                blankPicker.Code = "";
                blankPicker.Description = "-匹配规则-";

                pickerList.Add(blankPicker);
            }

            IList<Picker> locpickers = base.genericMgr.FindAll<Picker>("from Picker where Location = ? and IsActive = ?", new object[] { location, true });
            if (locpickers != null && locpickers.Count > 0)
            {
                foreach (Picker p in locpickers)
                {
                    pickerList.Add(p);
                }

                Picker blankPicker = new Picker();
                blankPicker.Code = "";
                blankPicker.Description = "-匹配库位-";

                pickerList.Add(blankPicker);
            }

            string hql = "from Picker l where  l.Code like ? and l.IsActive = ?";
            IList<object> paramList = new List<object>();

            paramList.Add(text + "%");
            paramList.Add(true);

            IList<Picker> nolocpickers = base.genericMgr.FindAll<Picker>(hql, paramList.ToArray(), firstRow, maxRow);
            if (nolocpickers != null)
            {
                foreach (Picker p in nolocpickers)
                {
                    pickerList.Add(p);
                }
            }

            Picker realblankPicker = new Picker();
            realblankPicker.Code = "";
            realblankPicker.Description = "-不分配-";
            pickerList.Add(realblankPicker);

            return new JsonResult { Data = new SelectList(pickerList, "Code", "Description", text) };
        }
Example #3
0
 public ActionResult New()
 {
     var picker = new Picker { IsActive = true };
     return View(picker);
 }