private void Validate(AdjustModel model, Adjust adjust, string actionName) { if (!string.IsNullOrEmpty(actionName)) { if (actionName == WorkflowActionName.Approve) { if (model.AdjustDate != null && model.AdjustDate < DateTime.UtcNow.Date) { ModelState.AddModelError("", _localizationService.GetResource("Adjust.AdjustDateCannotEarlierThanToday")); } if (adjust.IsApproved == true) { ModelState.AddModelError("", _localizationService.GetResource("Record.AlreadyApproved")); } var insufficientList = _adjustService.CheckSufficientQuantity(adjust); if (insufficientList.Count > 0) { foreach (var item in insufficientList) { ModelState.AddModelError("", string.Format(_localizationService.GetResource("Adjust.InSufficientQuantiy"), item.ItemName, item.StoreLocatorName)); } } } } }
public ActionResult Approve(AdjustModel model) { var adjust = _adjustRepository.GetById(model.Id); Validate(model, adjust, WorkflowActionName.Approve); if (ModelState.IsValid) { adjust = model.ToEntity(adjust); if (adjust.IsNew == true) { string number = _autoNumberService.GenerateNextAutoNumber(_dateTimeHelper.ConvertToUserTime(DateTime.UtcNow, DateTimeKind.Utc), adjust); adjust.Number = number; } //always set IsNew to false when saving adjust.IsNew = false; //update attributes _adjustRepository.Update(adjust); //commit all changes in UI this._dbContext.SaveChanges(); //approve _adjustService.Approve(adjust); //notification SuccessNotification(_localizationService.GetResource("Record.Saved")); return(Json(new { number = adjust.Number, isApproved = adjust.IsApproved })); } else { return(Json(new { Errors = ModelState.SerializeErrors() })); } }
public static string findRecipeInfo(string status, string begindate, string enddate, string eName) { AdjustModel am = new AdjustModel(); DataTable table = am.findRecipeInfo(Convert.ToInt32(status), begindate, enddate, eName); return(DataTableToJson.ToJson(table)); }
public static int addAdjust(string barcode, string SwapPer) { // string result = ""; AdjustModel am = new AdjustModel(); return(am.addAdjust(barcode, SwapPer)); /*if (sdr == 0) * { * result = "0"; * } * else * { * result = "1"; * } * * return result;*/ // if (dt.Rows.Count > 0) // { // return am.updateAdjust(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); // } // else // { // return am.addAdjust(userid, barcode1, wordcontent); //} }
protected void Page_Load(object sender, EventArgs e) { this.dotNetFlexGrid2.InitConfig( new string[] { "title=调剂信息", //标题 "striped=true", //是否显示行交替色 "selectedonclick=true", //是否点击行自动选中checkbox "usepager=false", //使用分页器 "showcheckbox=false", //显示复选框 "height=300", //高度,可为auto或具体px值 "width=605" //宽度,可为auto或具体px值 }, new dotNetFlexGrid.FieldConfig[] { // new dotNetFlexGrid.FieldConfig("id","调剂ID",60,true,dotNetFlexGrid.FieldConfigAlign.Center,false,true,false), new dotNetFlexGrid.FieldConfig("SwapPer", "调剂人员", 80, true, dotNetFlexGrid.FieldConfigAlign.Center), new dotNetFlexGrid.FieldConfig("wordDate", "日期", 100, true, dotNetFlexGrid.FieldConfigAlign.Center), new dotNetFlexGrid.FieldConfig("wordcontent", "工作内容", 200, true, dotNetFlexGrid.FieldConfigAlign.Center), new dotNetFlexGrid.FieldConfig("workload", "工作量", 200, false, dotNetFlexGrid.FieldConfigAlign.Center), }, null , null ); this.dotNetFlexGrid2.DataHandler = new dotNetFlexGrid.DataHandlerDelegate(DotNetFlexGrid1DataHandler); //提供数据的方法 AdjustModel am = new AdjustModel(); DataTable dt = am.findRecipeInfo(2, "", "", ""); this.chartData.Value = DataTableToJson.ToJson(dt); }
public static int delAdjust(int id) { AdjustModel rm = new AdjustModel(); int num = rm.delAdjust(id); return(num); }
public static string getNumByNAMEId(string SwapPer) { AdjustModel am = new AdjustModel(); DataTable dt = am.findNumById(SwapPer); string data = ""; data = dt.Rows[0][0].ToString(); //string a = data; return(data);; }
//导出数据 protected void Button1_Click(object sender, EventArgs e) { string status1 = status.Value; string begindate1 = begindate.Value; string enddate1 = enddate.Value; string eName1 = eName.Value; AdjustModel am = new AdjustModel(); // DataBaseLayer db = new DataBaseLayer(); // string str = "select * from lossiInfor where type ='" + type + "'"; DataTable dt = am.findRecipeInfo(Convert.ToInt32(status1), begindate1, enddate1, eName1); CreateExcel(dt, "application/ms-excel", "excel"); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { int id = Convert.ToInt16(Request.QueryString["id"]); idnum.Value = Request.QueryString["id"].ToString(); AdjustModel am = new AdjustModel(); DataTable dt = am.findAdjustById(id); Date.Value = Convert.ToDateTime(dt.Rows[0]["wordDate"].ToString()).ToString("yyyy-MM-dd"); WorkContent.Value = dt.Rows[0]["wordcontent"].ToString(); Workload.Value = dt.Rows[0]["workload"].ToString(); } }
public ActionResult SearchAdJustInv() { try { AdjustModel model = new AdjustModel(); IPublishInvoiceService PubIn = IoC.Resolve <IPublishInvoiceService>(); Company currentCom = ((EInvoiceContext)FXContext.Current).CurrentCompany; IList <string> lstpattern = PubIn.LstByPattern(currentCom.id, 2); model.lstpattern = new SelectList(lstpattern); model.lstserial = new SelectList(""); model.currentcom = currentCom; return(View(model)); } catch (Exception ex) { log.Error(" SearchAdJustInv -:" + ex); Messages.AddErrorFlashMessage("Có lỗi xảy ra, vui lòng thực hiện lại!"); return(RedirectToAction("Index", "Home")); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { AdjustModel am = new AdjustModel(); SqlDataReader sdr = am.findNameAll(); if (sdr != null) { while (sdr.Read()) { this.SwapPer.Items.Add(new ListItem(sdr["EmNumAName"].ToString())); // this.SwapPer.Items.Add(new ListItem(sdr["JobNum"].ToString())); } } DataBaseLayer db = new DataBaseLayer(); if (Session["userNamebar"] != null) { string name = Session["userNamebar"].ToString(); string sq1 = "select EmNumAName from Employee where jobnum ='" + name + "' "; SqlDataReader sr = db.get_Reader(sq1); if (sr.Read()) { SwapPer.Value = sr["EmNumAName"].ToString(); } } else { Response.Write("<script>alert('用户名已失效');window.parent.loginview();</script>"); } } }
public ActionResult CreateAdJustInv(AdjustModel model) { try { ICompanyService comSrv = IoC.Resolve <ICompanyService>(); Company currentCom = comSrv.Getbykey(((EInvoiceContext)FXContext.Current).CurrentCompany.id); IPublishInvoiceService PubIn = IoC.Resolve <IPublishInvoiceService>(); IInvoiceService IInvSrv = InvServiceFactory.GetService(model.pattern, currentCom.id); string ErrorMessage = ""; string newPattern = null, newSerial = null; int result = getTaxDeclaration(currentCom.id, model.pattern, model.serial, model.invNo); if (result > 0 && result != -2) { log.Error("Error CreateReplaceInv! Hóa đơn này chưa chốt kê khai thuế, vì vậy không thể thực hiện điều chỉnh. Hãy thực hiện nghiệp vụ thay thế hóa đơn!"); Messages.AddErrorFlashMessage("Hóa đơn này chưa chốt kê khai thuế, vì vậy không thể thực hiện điều chỉnh. Hãy thực hiện nghiệp vụ thay thế hóa đơn!"); return(RedirectToAction("SearchAdJustInv", new { pattern = model.pattern, serial = model.serial })); } //kiểm tra số hóa đơn của giải còn hay hết if (!LaunchInvoices.Instance.ExistNoInPubInv(currentCom.id, model.pattern, model.serial, out newPattern, out newSerial, out ErrorMessage)) { Messages.AddErrorFlashMessage(ErrorMessage); return(RedirectToAction("SearchAdJustInv", new { pattern = model.pattern, serial = model.serial })); } //Lấy ra đối tượng hóa đơn cần thay thế //Hóa đơn đã thay thế và kê khai thuế thì không được chỉnh sửa IInvoice inv = IInvSrv.GetByNo(currentCom.id, model.pattern, model.serial, Convert.ToDecimal(model.invNo)); if (inv.Status == InvoiceStatus.ReplacedInv || inv.Status == InvoiceStatus.CanceledInv) { Messages.AddErrorFlashMessage("Hóa đơn đã bị thay thế hoặc bị hủy!"); return(RedirectToAction("SearchAdJustInv")); } int type = 0; int.TryParse(model.type, out type); model.pattern = newPattern ?? model.pattern; model.serial = newSerial ?? model.serial; ViewData["NewPattern"] = model.pattern; ViewData["NewSerial"] = model.serial; ViewData["Data"] = inv; ViewData["company"] = currentCom; ViewData["type"] = model.type; //them dong chu tang hay giam ViewData["typeName"] = model.typeName; int signPlugin = 0; if (currentCom.Config.Keys.Contains("SignPlugin")) { int.TryParse(currentCom.Config["SignPlugin"], out signPlugin); } ViewData["SignPlugin"] = signPlugin; if (inv.Pattern != model.pattern) { IInvoice invNew = InvServiceFactory.NewInstance(model.pattern, currentCom.id); invNew.ComID = currentCom.id; invNew.Name = inv.Name; invNew.CusName = inv.CusName; invNew.CusCode = inv.CusCode; invNew.CusAddress = inv.CusAddress; invNew.Buyer = inv.Buyer; invNew.No = inv.No; invNew.Serial = inv.Serial; invNew.Note = ""; invNew.PaymentMethod = inv.PaymentMethod; invNew.Products = inv.Products; invNew.Pattern = inv.Pattern; invNew.Type = (InvoiceType)type; invNew.Amount = inv.Amount; invNew.Total = inv.Total; invNew.VATAmount = inv.VATAmount; string adjustView = InvServiceFactory.GetView(model.pattern, currentCom.id) + "CreateAdJustInv"; return(View(adjustView, invNew)); } inv.Note = ""; inv.Type = (InvoiceType)type; string ViewName = InvServiceFactory.GetView(model.pattern, currentCom.id) + "CreateAdJustInv"; return(View(ViewName, inv)); } catch (Exception ex) { log.Error(" CreateAdJustInv -:" + ex); Messages.AddErrorFlashMessage("Không tồn tại hóa đơn này!"); return(RedirectToAction("SearchAdJustInv")); } }
protected void Page_Load(object sender, EventArgs e) { String type = Request.QueryString["type"].ToString(); if ("save".Equals(type)) { try { // string strName = System.Web.HttpUtility.UrlDecode(Request["txtData"]); // byte[] bt = Convert.FromBase64String(base64string); string imgbase64 = Request.Form["imgbase64"]; // string imgbase64 = Request.QueryString["imgbase64"].ToString(); // string tisaneNum = Request.QueryString["tisaneNum"].ToString(); string tisaneNum = Request.Form["tisaneNum"]; // string userNum = Request.QueryString["userNum"].ToString(); string userNum = Request.Form["userNum"]; string barcode = Request.Form["barcode"]; string userName = Request.Form["userName"];//员工姓名 // string userName = Request.QueryString["userName"].ToString(); // string userName = Request.Form["userName"]; // imgbase64 = imgbase64.Replace("+", "%2B"); string imgname = null; if (imgbase64 != null && imgbase64.Trim().Length > 0) { imgbase64 = imgbase64.Replace(' ', '+'); Byte[] bimg = Convert.FromBase64String(imgbase64); //D:\\项目\\煎药厂\\src\\web\\upload\\ String path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "upload\\"; imgname = DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png"; FileBinaryConvertHelper.Bytes2File(bimg, path + imgname); } AdjustModel am = new AdjustModel(); DataTable dt = am.findAdjustBybarcode(tisaneNum); int result = 0; if (dt.Rows.Count > 0) { if ("1".Equals(dt.Rows[0]["status"].ToString())) { result = 0; } else { result = am.updateAdjust(Convert.ToInt32(dt.Rows[0]["id"].ToString()), 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), userName, tisaneNum); } } else { RecipeModel rm = new RecipeModel(); DataTable dtable = rm.findRecipeInfoByCheckId(Convert.ToInt32(tisaneNum)); if (dtable.Rows.Count > 0) { result = am.addAdjust(Convert.ToInt32(userNum), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), barcode, "调剂", tisaneNum, imgname, userName); } else { result = 0; } } if (result > 0) { Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\"}"); } else { Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}"); } } catch (Exception e1) { Response.Write("{\"code\":\"1\",\"msg\":\"操作失败\"}"); } } else if ("get".Equals(type)) { String id = Request.QueryString["id"].ToString(); RecipeModel rm = new RecipeModel(); DataTable dataTable = rm.findAdjustRecipeInfo(Convert.ToInt32(id), DateTime.Now.ToString("yyyy-MM-dd")); string adjustwarning = rm.getRetentionWarning(1); Response.Write("{\"code\":\"0\",\"msg\":\"操作成功\",\"data\":" + DataTableToJson.ToJson(dataTable) + ",\"warning\":\"" + adjustwarning + "\"}"); } // Response.Write(imgbase64 + "," + tisaneNum + "," + userNum + "," + userName); }
public dotNetFlexGrid.DataHandlerResult DotNetFlexGrid1DataHandler(dotNetFlexGrid.DataHandlerParams p) { dotNetFlexGrid.DataHandlerResult result = new dotNetFlexGrid.DataHandlerResult(); result.page = p.page; //设定当前返回的页号 result.total = 100; //总计的数据条数,此处用100进行模拟,查询和筛选时需要根据实际 AdjustModel am = new AdjustModel(); //0,未完成,1已完成,2全部 string status = "2"; if (p.extParam.ContainsKey("status")) { status = p.extParam["status"]; } string begindate = ""; if (p.extParam.ContainsKey("begindate")) { begindate = p.extParam["begindate"]; } string enddate = ""; if (p.extParam.ContainsKey("enddate")) { enddate = p.extParam["enddate"]; } string eName = ""; if (p.extParam.ContainsKey("eName")) { eName = p.extParam["eName"]; } result.table = am.findRecipeInfo(Convert.ToInt32(status), begindate, enddate, eName); // result.table = dotNetFlexGrid.DemoMemoryTable(p.page * 100, p.rp);//调用演示的数据生成函数产生模拟数据 //如果传递的参数包含排序设置的话,通过DataView.Sort功能模拟进行当页排序 //if (p.sortname.Length > 0 && p.sortorder.Length > 0) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.Sort = (p.sortname + " " + p.sortorder); // result.table = dv.ToTable(); //} ////处理默认查询,即Button1_Click中指定的DefaultSearch查询参数 //if (p.defaultSearch.ContainsKey("String1")) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.RowFilter = "String1 Like '%" + p.defaultSearch["String1"] + "%'"; // result.table = dv.ToTable(); //} ////如果传递的参数包含附加参数的话,再来模拟查询,原谅我真的很懒。 //if (p.extParam.ContainsKey("String1")) //{ // System.Data.DataView dv = result.table.DefaultView; // dv.RowFilter = "String1 Like '%" + p.extParam["String1"] + "%'"; // result.table = dv.ToTable(); //} ////如果传递的参数包含快速查询参数,则进行快速查询 //if (p.qop != dotNetFlexGrid.SerchParamConfigOperater.None && p.qtype.Length > 0 && p.query.Length > 0) //{ // System.Data.DataView dv = result.table.DefaultView; // if (p.qop == dotNetFlexGrid.SerchParamConfigOperater.Like) // dv.RowFilter = p.qtype + " Like '%" + p.query + "%'"; // else // dv.RowFilter = p.qtype + " = '" + p.query + "'"; // result.table = dv.ToTable(); //} return(result); }
public static int updateAdjust(int id, string wordcontent, string wordDate, string workload) { AdjustModel am = new AdjustModel(); return(am.updateAdjust(id, wordcontent, wordDate, workload)); }