public ActionResult Entry2(string pageId, string primaryKey, string formMode, string viewTitle) { ClearClientPageCache(Response); Entry2Model model = new Entry2Model(); SetParentEntryModel(pageId, formMode, viewTitle, model); model.SaveUrl = Url.Action("Entry2"); model.EntryGridLayout = EntryGridLayout(); model.EntryGridId = "EntryGrid"; model.PrinterName = AppMember.PrinterName; model.SelectUrl = Url.Action("Select", "AssetsManage", new { Area = "AssetsBusiness", pageId = model.PageId }); model.BarcodeStyleId = model.BarcodeStyleRepository.GetBarcodeDefaultStyle(); model.DefaultAssetsId = model.AssetsRepository.GetDefaultAssetsId(); if (formMode == "new2") { model.LabelType = "A"; } else if (formMode == "storeSite") { model.LabelType = "S"; } model.StoreSiteGridLayout = StoreSiteGridLayout(); model.StoreSiteGridId = "StoreSiteGrid"; SetThisEntryModel(model); return(View("Entry3", model)); }
protected int Update(BarcodePrintRepository rep, Entry2Model model, string viewTitle) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DataUpdate dbUpdate = new DataUpdate(); try { dbUpdate.BeginTransaction(); rep.DbUpdate = dbUpdate; rep.Update(model, sysUser, viewTitle); dbUpdate.Commit(); return(1); } catch (Exception ex) { dbUpdate.Rollback(); model.Message = ex.Message; model.HasError = "true"; return(0); } finally { dbUpdate.Close(); } }
protected int Delete(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("styleId", pkValue); string sql = @"select * from AppLabelStyle where styleId=@styleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppLabelStyle"; dt.Rows[0].Delete(); return(DbUpdate.Update(dt)); }
protected int Modified(Entry2Model model, UserInfo sysUser, string pkValue, string viewTitle) { Dictionary <string, object> paras = new Dictionary <string, object>(); paras.Add("styleId", pkValue); string sql = @"select * from AppLabelStyle where styleId=@styleId"; DataTable dt = AppMember.DbHelper.GetDataSet(sql, paras).Tables[0]; dt.TableName = "AppLabelStyle"; //dt.Rows[0]["styleName"] = model.BarcodeStyleName; dt.Rows[0]["xmlString"] = model.XmlString; Update5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
protected int Add(Entry2Model model, UserInfo sysUser, string viewTitle) { string sql = @"select * from AppLabelStyle where 1<>1 "; DataTable dt = AppMember.DbHelper.GetDataSet(sql).Tables[0]; dt.TableName = "AppLabelStyle"; DataRow dr = dt.NewRow(); dr["styleId"] = IdGenerator.GetMaxId(dt.TableName); dr["styleName"] = model.BarcodeStyleName; dr["xmlString"] = model.XmlString; dr["labelType"] = model.LabelType; dt.Rows.Add(dr); Create5Field(dt, sysUser.UserId, viewTitle); return(DbUpdate.Update(dt)); }
private void SetThisEntryModel(Entry2Model model) { model.AssetsClassUrl = Url.Action("DropList", "AssetsClass", new { Area = "BasicData", currentId = model.AssetsClassId }); model.AssetsClassDialogUrl = Url.Action("Select", "AssetsClass", new { Area = "BasicData" }); model.AssetsClassAddFavoritUrl = Url.Action("AddFavorit", "AssetsClass", new { Area = "BasicData", tableName = "AssetsClass" }); model.AssetsClassReplaceFavoritUrl = Url.Action("ReplaceFavorit", "AssetsClass", new { Area = "BasicData", tableName = "AssetsClass" }); model.DepartmentUrl = Url.Action("DropList", "Department", new { Area = "BusinessCommon", currentId = model.DepartmentId }); model.DepartmentDialogUrl = Url.Action("Select", "Department", new { Area = "BusinessCommon" }); model.DepartmentAddFavoritUrl = Url.Action("AddFavorit", "Department", new { Area = "BusinessCommon", tableName = "AppDepartment" }); model.DepartmentReplaceFavoritUrl = Url.Action("ReplaceFavorit", "Department", new { Area = "BusinessCommon", tableName = "AppDepartment" }); model.StoreSiteUrl = Url.Action("DropList", "StoreSite", new { Area = "BasicData", currentId = model.StoreSiteId }); model.StoreSiteDialogUrl = Url.Action("Select", "StoreSite", new { Area = "BasicData" }); model.StoreSiteAddFavoritUrl = Url.Action("AddFavorit", "StoreSite", new { Area = "BasicData", tableName = "StoreSite" }); model.StoreSiteReplaceFavoritUrl = Url.Action("ReplaceFavorit", "StoreSite", new { Area = "BasicData", tableName = "StoreSite" }); UserRepository user = new UserRepository(); model.UserSource = user.UserAutoCompleteSource(); }
public ActionResult Entry2(Entry2Model model) { model.EntryGridLayout = EntryGridLayout(); model.SelectUrl = Url.Action("Select", "AssetsManage", new { Area = "AssetsBusiness", pageId = model.PageId }); model.StoreSiteGridLayout = StoreSiteGridLayout(); BarcodePrintRepository Repository = new BarcodePrintRepository(); Update(Repository, model, model.ViewTitle); if (model.LabelType == "A") { model.FormMode = "new2"; } else if (model.LabelType == "S") { model.FormMode = "storeSite"; } SetThisEntryModel(model); return(View("Entry3", model)); }
public int Update(Entry2Model model, UserInfo sysUser, string viewTitle) { if (model.FormMode == "new") { return(Add(model, sysUser, viewTitle)); } else if (model.FormMode == "modified") { return(Modified(model, sysUser, model.BarcodeStyleId, viewTitle)); } else if (model.FormMode == "delete") { return(Delete(model, sysUser, model.BarcodeStyleId, viewTitle)); } else { return(0); } }
protected WhereConditon EntryGridWhereSql(string formVar) { WhereConditon wcd = new WhereConditon(); wcd.DBPara = new Dictionary <string, object>(); if (formVar == null) { wcd.Sql += " and 1<>1 "; } Entry2Model model = JsonHelper.Deserialize <Entry2Model>(formVar); if (model == null) { return(wcd); } if (DataConvert.ToString(model.AssetsNo) != "") { wcd.Sql += @" and Assets.assetsNo like '%'+@assetsNo+'%'"; wcd.DBPara.Add("assetsNo", model.AssetsNo); } if (DataConvert.ToString(model.AssetsName) != "") { wcd.Sql += @" and Assets.assetsName like '%'+@assetsName+'%'"; wcd.DBPara.Add("assetsName", model.AssetsName); } if (DataConvert.ToString(model.AssetsBarcode) != "") { wcd.Sql += @" and Assets.assetsBarcode like '%'+@assetsBarcode+'%'"; wcd.DBPara.Add("assetsBarcode", model.AssetsBarcode); } if (DataConvert.ToString(model.AssetsClassId) != "") { wcd.Sql += @" and Assets.assetsClassId=@assetsClassId"; wcd.DBPara.Add("assetsClassId", model.AssetsClassId); } if (DataConvert.ToString(model.DepartmentId) != "") { wcd.Sql += @" and Assets.departmentId=@departmentId"; wcd.DBPara.Add("departmentId", model.DepartmentId); } if (DataConvert.ToString(model.StoreSiteId) != "") { wcd.Sql += @" and Assets.storeSiteId=@storeSiteId"; wcd.DBPara.Add("storeSiteId", model.StoreSiteId); } if (DataConvert.ToString(model.AssetsState) != "") { wcd.Sql += @" and Assets.assetsState=@assetsState"; wcd.DBPara.Add("assetsState", model.AssetsState); } if (DataConvert.ToString(model.UsePeople) != "") { wcd.Sql += @" and Assets.usePeople like '%'+@usePeople+'%'"; wcd.DBPara.Add("usePeople", model.UsePeople); } if (DataConvert.ToString(model.Keeper) != "") { wcd.Sql += @" and Assets.keeper like '%'+@keeper+'%'"; wcd.DBPara.Add("keeper", model.Keeper); } if (DataConvert.ToString(model.ProjectManageId) != "") { wcd.Sql += @" and Assets.projectManageId=@projectManageId"; wcd.DBPara.Add("projectManageId", model.ProjectManageId); } if (DataConvert.ToString(model.PurchaseDateFrom) != "") { wcd.Sql += @" and Assets.purchaseDate>=@purchaseDateFrom"; wcd.DBPara.Add("purchaseDateFrom", DataConvert.ToString(model.PurchaseDateFrom) + " 00:00:00"); } if (DataConvert.ToString(model.PurchaseDateTo) != "") { wcd.Sql += @" and Assets.purchaseDate<=@purchaseDateTo"; wcd.DBPara.Add("purchaseDateTo", DataConvert.ToString(model.PurchaseDateTo) + " 23:59:59"); } if (DataConvert.ToString(model.CompanyId) != "") { wcd.Sql += @" and D.companyId=@companyId"; wcd.DBPara.Add("companyId", model.CompanyId); } return(wcd); }