private void DoAdd() { //管理权限 string navID = ""; string month = ""; string txtdatefrom = ""; string validCheck = ""; List <MANAGERROLEVALUE> ls = new List <MANAGERROLEVALUE>(); for (int i = 0; i < rptList.Items.Count; i++) { string hidLayer = ((HiddenField)rptList.Items[i].FindControl("hidLayer")).Value; navID = ((HiddenField)rptList.Items[i].FindControl("hidID")).Value; if (hidLayer == "1") { month = ((HtmlInputText)rptList.Items[i].FindControl("validmonth")).Value; txtdatefrom = ((HtmlInputText)rptList.Items[i].FindControl("txtdatefrom")).Value; ls.Add(new MANAGERROLEVALUE { NavID = int.Parse(navID), Valid = int.Parse(month), StartTime = DateTime.Parse(txtdatefrom) }); } else { validCheck = ((HtmlInputCheckBox)rptList.Items[i].FindControl("checkValid")).Checked == true?"1":"0"; } if (!String.IsNullOrEmpty(month) && !String.IsNullOrEmpty(txtdatefrom) && hidLayer == "2" && validCheck == "1") { ls.Add(new MANAGERROLEVALUE { NavID = int.Parse(navID), Valid = int.Parse(month), StartTime = DateTime.Parse(txtdatefrom) }); } } //if (roleid == 0) //{ // roleid = servComm.AddOrUpdate(model); //} //else { // servComm.AddOrUpdate(model); //} servComm.ExecuteSql(" delete from W_MANAGER_ROLE_VALUE where JGCID = " + roleid.ToString()); servComm.ExecuteSql(" update JX_USERS set StartTime= '" + txtdatefrom + "',ValidDay=" + month + ",EndTime='" + DateTime.Parse(txtdatefrom).AddMonths(int.Parse(month)) + "' where ID = " + roleid.ToString()); foreach (MANAGERROLEVALUE modelRole in ls) { modelRole.JGCID = roleid; servComm.Add(modelRole); } servComm.ExecuteSql(" exec SynchronizeDataBase " + roleid.ToString()); Response.Redirect("RoleList.aspx?type=System"); }
protected void Page_Load(object sender, EventArgs e) { ModelSpec modelSpec = new ModelSpec(); modelSpec.Class = "A"; modelSpec.Color = "Black"; modelSpec.exterior = "exterior"; modelSpec.Size = "Size"; modelSpec.OrderNo = "OrderNo"; modelSpec.Remark = "Remark"; servComm.Add(modelSpec); #region 页面加载 if (!IsPostBack) { DataSet ds = dal.SelectAll(); this.UserSelectGridView.DataSource = ds; UserSelectGridView.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { if (AttachFile.HasFile) { string FileName = this.AttachFile.FileName; //获取上传文件的文件名,包括后缀 string ExtenName = System.IO.Path.GetExtension(FileName); //获取扩展名 string SaveFileName = System.IO.Path.Combine( Request.PhysicalApplicationPath + SaveFilePath, DateTime.Now.ToString("yyyyMMddhhmmss") + ExtenName); //合并两个路径为上传到服务器上的全路径 AttachFile.MoveTo(SaveFileName, Brettle.Web.NeatUpload.MoveToOptions.Overwrite); string url = Request.Url.GetLeftPart(UriPartial.Authority) + SaveFilePath + DateTime.Now.ToString("yyyyMMddhhmmss") + ExtenName; //文件保存的路径 float FileSize = (float)System.Math.Round((float)AttachFile.ContentLength / 1024000, 1); //获取文件大小并保留小数点后一位,单位是M WORDERSATTACHMENTS model = new WORDERSATTACHMENTS(); model.ModelNo = Request["ModelNo"]; model.Filename = FileName; model.FilePath = url; model.CreateDate = DateTime.Now; model.BelongFactory = LoginUser.BelongFactory; servComm.Add(model); BindList(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { } string type = Request["actiontype"]; if (type != null) { if (type == "SaveMainClass") { if (Request["DelMainClass"] != null && Request["DelClassID"] != null) { servComm.ExecuteSql(" delete from Dict where MainClass = '" + Request["DelMainClass"] + "' and ClassID = '" + Request["DelClassID"] + "'"); servComm.ExecuteSql(" delete from DictDetail where ClassID = '" + Request["DelClassID"] + "'"); } else { string MainClass = Request["MainClass"]; string ClassID = Request["ClassID"]; string ClassName = Request["ClassName"]; string Sortno = Request["Sortno"]; try { if (!String.IsNullOrEmpty(ClassID)) { ModelDict modelDict = new ModelDict(); modelDict.MainClass = MainClass; modelDict.ClassID = ClassID; modelDict.ClassName = ClassName; modelDict.Sortno = int.Parse(Sortno); modelDict.UpdateTime = DateTime.Now; modelDict.UpdateUser = LoginUser.UserName; if (servComm.ExecuteSqlDatatable("select ClassID from Dict where MainClass = '" + MainClass + "' and ClassID = '" + ClassID + "'").Rows.Count > 0) { ccWhere.AddComponent("MainClass", MainClass, SearchComponent.Equals, SearchPad.NULL); ccWhere.AddComponent("ClassID", ClassID, SearchComponent.Equals, SearchPad.And); servComm.Update(modelDict, ccWhere); } else { servComm.Add(modelDict); } } } catch (Exception ex) { Response.Write("-1"); Response.End(); } } servComm.strOrderString = "MainClass,Sortno"; List <ModelDict> listObj = servComm.GetListTop <ModelDict>(0, "*", "Dict", null).ToList <ModelDict>(); var timeConvert = new IsoDateTimeConverter(); timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert); Response.Write(responseJson); Response.End(); } else if (type == "GetMainClass") { servComm.strOrderString = "Sortno"; List <ModelDict> listObj = servComm.GetListTop <ModelDict>(0, "*", "Dict", null).ToList <ModelDict>(); var timeConvert = new IsoDateTimeConverter(); timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert); Response.Write(responseJson); Response.End(); } else if (type == "GetDetail") { servComm.strOrderString = "Sortno"; ConditionComponent ccwhere = new ConditionComponent(); ccwhere.AddComponent("ClassID", Request["selectMainClass"], SearchComponent.Equals, SearchPad.NULL); List <ModelDictDetail> listObj = servComm.GetListTop <ModelDictDetail>(0, "*", "DictDetail", ccwhere).ToList <ModelDictDetail>(); var timeConvert = new IsoDateTimeConverter(); timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert); Response.Write(responseJson); Response.End(); } else if (type == "SaveClass") { string jsonResult = Request["data"]; List <ModelDictDetail> listModel = Utility.ConvertJsonToEntity <ModelDictDetail>(jsonResult.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); string SelectClassID = Request["selectMainClass"]; servComm.ExecuteSql(" delete from DictDetail where ClassID = '" + SelectClassID + "'"); foreach (ModelDictDetail model in listModel) { if (!String.IsNullOrEmpty(model.Code)) { model.ClassID = SelectClassID; model.OperTime = DateTime.Now; model.oper = LoginUser.UserName; servComm.Add(model); } } DataCache.dict = servComm.GetListTop <ModelDictDetail>(0, null).ToList(); Response.Write("DictDetail"); Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { listClassType = DataCache.findAllDict().Where(model => model.ClassID == "MaterialType").ToList(); listClassType.Insert(0, new ModelDictDetail() { }); servComm.strOrderString = "Client"; ccWhere.Clear(); ccWhere.AddComponent("Class", "A", SearchComponent.Equals, SearchPad.NULL); ccWhere.AddComponent("Class", "B", SearchComponent.Equals, SearchPad.Or); listSeler = servComm.GetListTop <ModelClient>(0, ccWhere); listDictType = DataCache.findAllDict().Where(model => model.ClassID == "BillType").ToList(); listDictType.Insert(0, new ModelDictDetail() { }); servComm.strOrderString = " OrderNo "; ccWhere.Clear(); ccWhere.AddComponent("OrderNo", null, SearchComponent.ISNOT, SearchPad.NULL); ccWhere.AddComponent("Bh", null, SearchComponent.ISNOT, SearchPad.And); IList <ModelSpec> listSaleDetail = servComm.GetListTop <ModelSpec>(0, "OrderNo,Bh", "Spec", ccWhere); string SpecJson = JsonConvert.SerializeObject(listSaleDetail, Formatting.Indented, new IsoDateTimeConverter()); OrderJson = SpecJson.Replace("\r\n", ""); } string Id = Request["Id"]; if (!String.IsNullOrEmpty(Id)) { servComm.strOrderString = "Id"; ModelSale modelSale = servComm.GetEntity <ModelSale>(Request["Id"]); var timeConvert = new IsoDateTimeConverter(); timeConvert.DateTimeFormat = "yyyy-MM-dd"; string modelJson = JsonConvert.SerializeObject(modelSale, Formatting.Indented, timeConvert); ccWhere.Clear(); ccWhere.AddComponent("Id", Id, SearchComponent.Equals, SearchPad.NULL); IList <ModelSaleDetail> listSaleDetail = servComm.GetListTop <ModelSaleDetail>(0, "*", "SaleDetail", ccWhere); string listJson = JsonConvert.SerializeObject(listSaleDetail, Formatting.Indented, timeConvert); EditJson = modelJson.Replace("}", ",\"DetailJson\":") + listJson + "}"; EditJson = EditJson.Replace("\r\n", ""); //"[{\"RowCount\":"+servComm.RowCount + ",\"JsonData\":"+ responseJson+"}]" } if (Request["actiontype"] == "SaveSales") { int identityID = 0; try { ModelSale modelSale = new ModelSale(); DateTime?TimeNull = null; modelSale.SaleDate = String.IsNullOrEmpty(Request["SaleDate"]) ? TimeNull : DateTime.Parse(Request["SaleDate"].ToString()); modelSale.Seller = Request["Seller"]; modelSale.Salesperson = Request["Salesperson"]; modelSale.BillDate = String.IsNullOrEmpty(Request["BillDate"]) ? TimeNull : DateTime.Parse(Request["BillDate"].ToString());; modelSale.BillNo = Request["BillNo"]; modelSale.Addr = Request["Addr"]; modelSale.Receiver = Request["Receiver"]; modelSale.Tel = Request["Tel"]; modelSale.Distri = Request["Distri"]; modelSale.DistriNo = Request["DistriNo"]; modelSale.BillClass = Request["BillClass"]; modelSale.IsDel = "0"; modelSale.Reg = LoginUser.UserName; modelSale.RegTime = DateTime.Now; if (String.IsNullOrEmpty(Request["Id"])) { identityID = servComm.Add(modelSale); } else { identityID = int.Parse(Request["Id"]); modelSale.Id = identityID; int result = servComm.Update(modelSale); } string jsonResult = Request["SalesDetail"]; jsonResult = jsonResult.Replace("[", "").Replace("]", "").Replace("},{", "}|{").Replace("\"Id\":\"\"", "\"Id\":" + identityID.ToString()); List <ModelSaleDetail> listModel = Utility.ConvertJsonToEntity <ModelSaleDetail>(jsonResult.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries)); servComm.ExecuteSql(" delete from SaleDetail where ID = '" + identityID + "';"); int serialIndex = 0; foreach (ModelSaleDetail modelDetail in listModel) { serialIndex = serialIndex + 1; modelDetail.Serial = serialIndex; servComm.Add(modelDetail); } if (String.IsNullOrEmpty(Request["Id"])) { servComm.ExecuteSql("exec AutoDetectionNoCard " + identityID + "," + LoginUser.UserName); } else { servComm.ExecuteSql("exec AutoDetectionNoCard " + identityID + "," + identityID); } } catch (Exception ex) { Response.Write(0); Response.End(); } Response.Write(identityID); Response.End(); } else if (Request["actionType"] == "GetMaxCardNo") { DataTable dtCardNo = servComm.ExecuteSqlDatatable("select max(NoEnd) as MaxNo from CardNoMaintenance"); if (dtCardNo.Rows.Count == 0) { Response.Write("00000000"); Response.End(); } else { string maxNo = dtCardNo.Rows[0][0].ToString(); maxNo = (int.Parse(maxNo) + 1).ToString().PadLeft(8, '0'); Response.Write(maxNo); Response.End(); } } else if (Request["actionType"] == "DeleteCardNo") { string NoStart = Request["NoStart"]; string NoEnd = Request["NoEnd"]; if (!String.IsNullOrEmpty(NoStart) && !String.IsNullOrEmpty(NoEnd)) { servComm.ExecuteSql("update CardNoMaintenance set IsSave = 2 where NoEnd ='" + NoEnd + "' and NoStart = '" + NoStart + "'"); } } else if (Request["actiontype"] == "ValidCardNo") { string NoStart = Request["NoStart"]; string NoEnd = Request["NoEnd"]; string Serial = Request["Serial"]; ccWhere.Clear(); string condition = ""; if (Serial != null && Serial == "-1") { Serial = Request["DetailCount"]; } else if (Serial != null && Serial != "-1" && !String.IsNullOrEmpty(Id)) { condition = condition + " and (ID !='" + Id + "' or ID ='" + Id + "' and Serial != " + Serial + ")"; //ccWhere.AddComponent("Id", Id, SearchComponent.Equals, SearchPad.NULL); //ccWhere.AddComponent("Serial", Serial, SearchComponent.UnEquals, SearchPad.And); } else { condition = condition + " and (ID !='" + LoginUser.UserName + "' or ID ='" + LoginUser.UserName + "' and Serial != " + Serial + ")"; } int count = servComm.ExecuteSqlDatatable("select Id from CardNoMaintenance where (NoStart<='" + NoStart + "' and NoEnd>='" + NoStart + "' or NoStart<='" + NoEnd + "' and NoEnd>='" + NoEnd + "' or NoStart>='" + NoStart + "' and NoEnd<='" + NoEnd + "')" + condition).Rows.Count; if (count == 0) { if (String.IsNullOrEmpty(Id)) { servComm.ExecuteSql("delete from CardNoMaintenance where ID ='" + LoginUser.UserName + "' and Serial = " + Serial + "; insert into CardNoMaintenance values('" + LoginUser.UserName + "','" + Serial + "','" + NoStart + "','" + NoEnd + "',GetDate(),0)"); } else { servComm.ExecuteSql("delete from CardNoMaintenance where ID ='" + Id + "' and Serial = " + Serial + ";insert into CardNoMaintenance values('" + Id + "','" + Serial + "','" + NoStart + "','" + NoEnd + "',GetDate(),0)"); } Response.Write(count); Response.End(); } } //if (modelSale.ExecuteSqlDatatable("select ClassID from Dict where ClassID = '" + ClassID + "'").Rows.Count > 0) //{ // servComm.Update(modelDict); //} //else //{ //} }
protected void Page_Load(object sender, EventArgs e) { try { servCommfac = new ServiceCommon(factoryConnectionString); if (!IsPostBack) { ((HtmlContainerControl)Master.FindControl("HTitle")).InnerText = IsCN? "订单输入":"Order Input"; ddlOrderType.DataSource = BindDictClass(servCommfac, ccWhere, "OrderClass"); ddlOrderType.DataBind(); } timeStamp = TenpayUtil.getTimestamp(); signalticket = GetSignalTicket(timeStamp, Session["APPID"].ToString(), Session["APPSECRET"].ToString()); if (GetOrganization.Count > 0) { userSellerID = GetOrganization["sellerid"].ToString();; } if (GetOrganization.Count == 2) { userHospitalID = GetOrganization["hospitalid"].ToString(); } else if (GetOrganization.Count == 3) { userHospitalID = GetOrganization["hospitalid"].ToString(); userDoctorID = GetOrganization["doctorid"].ToString(); } GetSceneryTypeList(); GetColors(); GetDoctorRequire(); if (Request["action"] == "autoNo") { DataTable dtNumber = servComm.ExecuteSqlDatatable("select dbo.fn_GetAutoOrderNo(N'" + LoginUser.UserName + "','" + DateTime.Now.ToString("yyMMdd") + "','" + LoginUser.BelongFactory + "')"); if (dtNumber.Rows.Count > 0) { Response.Write(dtNumber.Rows[0][0].ToString().Trim()); Response.End(); } else { Response.Write(""); Response.End(); } } string serverImage = Request["uploadimage"]; string AccessoryList = Request["AccessoryList"]; string path = Server.MapPath("~" + SaveFilePath); //网站中有一个 uploadedFiles 文件夹,存储上传来的图片 string photoList = ""; //生成文件名(系统要重新生成一个文件名,但注意扩展名要相同。千万不要用中文名称!!!) Log.LogInfo(serverImage); if (!String.IsNullOrEmpty(serverImage)) { string file = string.Empty; string content = string.Empty; string strpath = string.Empty; string savepath = string.Empty; for (int i = 0; i < serverImage.Split(',').Length; i++) { string stUrl = "http://file.api.weixin.qq.com/cgi-bin/media/get?access_token=" + GetAccessToken(Session["APPID"].ToString(), Session["APPSECRET"].ToString()) + "&media_id=" + serverImage.Split(',')[i]; HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(stUrl); req.Method = "GET"; using (WebResponse wr = req.GetResponse()) { HttpWebResponse myResponse = (HttpWebResponse)req.GetResponse(); strpath = myResponse.ResponseUri.ToString(); WebClient mywebclient = new WebClient(); string filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next().ToString().Substring(0, 4) + ".jpg"; savepath = path + "\\" + filename; try { Log.LogInfo(savepath); mywebclient.DownloadFile(strpath, savepath); System.Drawing.Image img = System.Drawing.Image.FromFile(savepath); if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Png)) { filename = DateTime.Now.ToString("yyyyMMddHHmmssfff") + (new Random()).Next().ToString().Substring(0, 4) + ".png"; img.Save(path + "\\" + filename); file = Request.Url.GetLeftPart(UriPartial.Authority) + SaveFilePath + filename; } else { file = Request.Url.GetLeftPart(UriPartial.Authority) + SaveFilePath + filename; } photoList = photoList + "," + file; Log.LogInfo(file); } catch (Exception ex) { Log.LogInfo(ex.Message); } } photoList = photoList.Trim(','); } } if (yeyRequest.Params("haddinfo") == "1") { string seller = Request["seller"]; string hospital = Request["hospital"]; string doctor = Request["doctor"]; string patient = Request["patient"]; ordreModel.ModelNo = Request["txtModelNo"]; ordreModel.OrderClass = ddlOrderType.Value; ordreModel.SellerID = decimal.Parse(seller); ordreModel.HospitalID = decimal.Parse(hospital); ordreModel.DoctorId = decimal.Parse(doctor); ordreModel.Patient = Request["txtpatient"]; if (Request["txtAge"] != "") { ordreModel.Age = decimal.Parse(Request["txtAge"]); } ordreModel.Sex = Request["ddlSex"]; ordreModel.danzuo = Request["ddlSingle"]; ordreModel.Fenge = Request["ddlDivision"]; if (!String.IsNullOrEmpty(Request["Require"])) { ordreModel.Require = Request["Require"].Replace("'", ""); } ordreModel.RegTime = DateTime.Now; ordreModel.RegName = LoginUser.UserName; ordreModel.BelongFactory = LoginUser.BelongFactory; if (!String.IsNullOrEmpty(yeyRequest.Params("keyID"))) { servComm.Update(ordreModel); } else { servComm.Add(ordreModel); } //string AccessoryList = Request["OtherList"]; if (AccessoryList != "") { servComm.ExecuteSql(" delete from W_ordersOther where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'"); string[] otherSplit = AccessoryList.Split(':'); WORDERSOTHER otherModel = new WORDERSOTHER(); ccWhere.Clear(); ccWhere.AddComponent("ClassID", "Accessory", SearchComponent.Equals, SearchPad.NULL); DataTable dtAccessory = servCommfac.GetListTop(0, "DictDetail", ccWhere); for (int i = 0; i < otherSplit.Length; i++) { string accessoryName = ""; if (dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'").Length > 0) { accessoryName = dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'")[0]["DictName"].ToString(); } otherModel.ModelNo = Request["txtModelNo"]; otherModel.SubId = i + 1; otherModel.Code = otherSplit[i].Split(',')[0]; otherModel.name = accessoryName; otherModel.qty = decimal.Parse(otherSplit[i].Split(',')[1]); otherModel.BelongFactory = LoginUser.BelongFactory; servComm.Add(otherModel); } } if (photoList != "") { servComm.ExecuteSql(" delete from W_OrderPhotos where ModelNo='" + Request["txtModelNo"] + "' and BelongFactory = '" + LoginUser.BelongFactory + "'"); string[] photoSplit = photoList.Split(','); WORDERSPHOTOS photoModel = new WORDERSPHOTOS(); for (int i = 0; i < photoSplit.Length; i++) { photoModel.ModelNo = Request["txtModelNo"]; photoModel.SubId = i + 1; photoModel.picpath = photoSplit[i]; photoModel.BelongFactory = LoginUser.BelongFactory; servComm.Add(photoModel); } } string[] ddlSmallClass = Request["ddlSmallClass"].Split(','); string[] ddlItemName = Request["ddlItemName"].Split(','); string[] righttop = Request["righttop"].Split(','); string[] lefttop = Request["lefttop"].Split(','); string[] rightbottom = Request["rightbottom"].Split(','); string[] leftbottom = Request["leftbottom"].Split(','); string[] ProductColor = Request["hidProductColor"].Split(','); string[] ProductCount = Request["ProductCount"].Split(','); servComm.ExecuteSql(" delete from W_OrdersDetail where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'"); int index = 1; for (int i = 0; i < ddlSmallClass.Length; i++) { WORDERSDETAIL detailMode = new WORDERSDETAIL(); detailMode.a_teeth = righttop[i]; detailMode.b_teeth = lefttop[i]; detailMode.c_teeth = rightbottom[i]; detailMode.d_teeth = leftbottom[i]; detailMode.ProductId = ddlItemName[i]; detailMode.bColor = ProductColor[i].Replace(":", ","); detailMode.Qty = int.Parse(ProductCount[i]); detailMode.subId = index; detailMode.ModelNo = Request["txtModelNo"]; detailMode.BelongFactory = LoginUser.BelongFactory; servComm.Add(detailMode); index = index + 1; } Response.Redirect("OrderInput.aspx"); } } catch (Exception ex) { } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request["customertype"])) { CustomerType = Request["customertype"]; } string actiontype = Request["actiontype"]; if (actiontype == "GetCustomerManageList") { string Serial = Request["Serial"]; ccwhere.AddComponent("Class", "S", SearchComponent.UnEquals, SearchPad.And); if (!String.IsNullOrEmpty(Serial)) { ccwhere.AddComponent("Serial", "%" + Serial + "%", SearchComponent.Like, SearchPad.And); } string Class = Request["Class"]; if (!String.IsNullOrEmpty(Class)) { ccwhere.AddComponent("Class", "%" + Class + "%", SearchComponent.Like, SearchPad.And); } string Client = Request["Client"]; if (!String.IsNullOrEmpty(Client)) { ccwhere.AddComponent("Client", "%" + Client + "%", SearchComponent.Like, SearchPad.And); } string linkman = Request["linkman"]; if (!String.IsNullOrEmpty(linkman)) { ccwhere.AddComponent("linkman", "%" + linkman + "%", SearchComponent.Like, SearchPad.And); } int iPageCount = 0; int iPageIndex = int.Parse(Request["PageIndex"]) + 1; servComm.strOrderString = "Id desc"; listObj = servComm.GetList <ModelClient>("Client", "*", "Id", 10, iPageIndex, iPageCount, ccwhere); var timeConvert = new IsoDateTimeConverter(); //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert); Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]"); Response.End(); } else if (actiontype == "ExportExcel") { string BillNo = Request["BillNo"]; if (!String.IsNullOrEmpty(BillNo)) { ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And); } string Salesperson = Request["Salesperson"]; if (!String.IsNullOrEmpty(Salesperson)) { ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And); } string IsDel = Request["IsDel"]; if (!String.IsNullOrEmpty(IsDel)) { ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And); } else { ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And); } servComm.strOrderString = "Id"; listObj = servComm.GetListTop <ModelClient>(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere); string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx"; string fileName = Request.PhysicalApplicationPath + "UploadFile\\" + shortName; using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\")) { DataTable dtTable = listObj.ToDataTable(); dtTable.Columns.Remove("IsDel"); int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true); } Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName); Response.End(); } else if (Request["actiontype"] == "SaveCustomer") { int identityID = 0; try { ModelClient modelClient = new ModelClient(); if (String.IsNullOrEmpty(Request["Id"])) { modelClient.Class = Request["Class"]; modelClient.Serial = Request["Serial"]; modelClient.Client = Request["Client"]; modelClient.linkman = Request["linkman"]; modelClient.Tel = Request["Tel"]; modelClient.Tel2 = Request["Tel2"]; modelClient.Country = Request["Country"]; modelClient.Province = Request["Province"]; modelClient.City = Request["City"]; modelClient.Email = Request["Email"]; modelClient.Addr = Request["Addr"]; modelClient.UserName = Request["UserName"]; if (servComm.ExecuteSqlDatatable("select ID from Client where UserName ='******'").Rows.Count > 0) { identityID = -1; } else { string password = CryptoHelper.StaticEncrypt("1"); //} modelClient.Passwd = password; identityID = servComm.Add(modelClient); } //string password = Request["Passwd"]; //if (!String.IsNullOrEmpty(password)) //{ } else { if (String.IsNullOrEmpty(Request["Class"])) { identityID = servComm.ExecuteSql(" delete from Client where ID in (" + Request["Id"] + ");"); } else { identityID = int.Parse(Request["Id"]); modelClient.Class = Request["Class"]; modelClient.Serial = Request["Serial"]; modelClient.Client = Request["Client"]; modelClient.linkman = Request["linkman"]; modelClient.Tel = Request["Tel"]; modelClient.Tel2 = Request["Tel2"]; modelClient.Country = Request["Country"]; modelClient.Province = Request["Province"]; modelClient.City = Request["City"]; modelClient.Email = Request["Email"]; modelClient.Addr = Request["Addr"]; modelClient.UserName = Request["UserName"]; if (servComm.ExecuteSqlDatatable("select ID from Client where UserName ='******' and ID !=" + identityID).Rows.Count > 0) { identityID = -1; } else { string password = Request["Passwd"]; if (!String.IsNullOrEmpty(password)) { password = CryptoHelper.StaticEncrypt("1"); } modelClient.Passwd = password; modelClient.ID = identityID; int result = servComm.Update(modelClient); } } } } catch (Exception ex) { Response.Write(0); Response.End(); } Response.Write(identityID); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ModelBase modelSale = servComm.GetEntity <ModelBase>("1"); var timeConvert = new IsoDateTimeConverter(); timeConvert.DateTimeFormat = "yyyy-MM-dd"; string modelJson = JsonConvert.SerializeObject(modelSale, Formatting.Indented, timeConvert); EditJson = modelJson.Replace("\r\n", ""); } string actiontype = Request["actiontype"]; if (actiontype == "GetProductList") { servComm.strOrderString = "itemname collate Chinese_PRC_CS_AS_KS_WS"; // ccWhere.AddComponent("Serial", LoginUser.Serial, SearchComponent.Equals, SearchPad.NULL); DataTable dtProduct = servComm.GetListTop(0, "products", ccWhere); var timeConvert = new IsoDateTimeConverter(); //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(dtProduct, Formatting.Indented, timeConvert); Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]"); Response.End(); } else if (actiontype == "SaveBase") { int identityID = 1; try { ModelBase modelBase = new ModelBase(); modelBase.ID = 1; modelBase.corp = Request["corp"].ToString(); modelBase.Ecorp = Request["Ecorp"].ToString(); modelBase.Address = Request["Address"]; modelBase.Email = Request["Email"]; modelBase.fax = Request["fax"]; modelBase.LinkMan = Request["LinkMan"]; modelBase.netname = Request["netname"]; modelBase.phone = Request["phone"]; modelBase.ServerIP = Request["ServerIP"]; modelBase.ProductID = Request["ProductID"]; modelBase.RoleA = Request["RoleA"].Trim(':'); modelBase.RoleB = Request["RoleB"].Trim(':'); modelBase.RoleC = Request["RoleC"].Trim(':'); modelBase.RoleD = Request["RoleD"].Trim(':'); servComm.Delete <ModelBase>("1", true); servComm.Add(modelBase); } catch (Exception ex) { Response.Write(0); Response.End(); } Response.Write(identityID); Response.End(); } else if (actiontype == "DeleteHisData") { try { string factoryEndDate = Request["factoryEndDate"]; string salesEndDate = Request["salesEndDate"]; servComm.ExecuteSql("exec SP_DeleteHistory '" + factoryEndDate + "','" + salesEndDate + "'"); } catch (Exception ex) { Response.Write(0); Response.End(); } Response.Write("1"); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { listClassType = DataCache.findAllDict().Where(model => model.ClassID == "MaterialType").ToList(); listClassType.Insert(0, new ModelDictDetail() { }); } string actiontype = Request["actiontype"]; if (actiontype == "GetSpecManageList") { string Bh = Request["Bh"]; if (!String.IsNullOrEmpty(Bh)) { ccwhere.AddComponent("Bh", "%" + Bh + "%", SearchComponent.Like, SearchPad.And); } string Class = Request["Class"]; if (!String.IsNullOrEmpty(Class)) { ccwhere.AddComponent("Class", Class, SearchComponent.Equals, SearchPad.And); } string OrderNo = Request["OrderNo"]; if (!String.IsNullOrEmpty(OrderNo)) { ccwhere.AddComponent("OrderNo", "%" + OrderNo + "%", SearchComponent.Like, SearchPad.And); } int iPageCount = 0; int iPageIndex = int.Parse(Request["PageIndex"]) + 1; servComm.strOrderString = "Id desc "; listObj = servComm.GetList <ModelSpec>("Spec", "*", "Id", 10, iPageIndex, iPageCount, ccwhere); listObj.ToList().ForEach(eo => eo.Class = (listClassType.Where(le => le.Code == eo.Class).Count() > 0 ? listClassType.Where(le => le.Code == eo.Class).FirstOrDefault().DictName : "")); var timeConvert = new IsoDateTimeConverter(); //timeConvert.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; timeConvert.DateTimeFormat = "yyyy-MM-dd"; string responseJson = JsonConvert.SerializeObject(listObj, Formatting.Indented, timeConvert); responseJson = responseJson.Replace(": null", ": \"\""); Response.Write("[{\"RowCount\":" + servComm.RowCount + ",\"JsonData\":" + responseJson + "}]"); Response.End(); } else if (actiontype == "ExportExcel") { string BillNo = Request["BillNo"]; if (!String.IsNullOrEmpty(BillNo)) { ccwhere.AddComponent("BillNo", "%" + BillNo + "%", SearchComponent.Like, SearchPad.And); } string Salesperson = Request["Salesperson"]; if (!String.IsNullOrEmpty(Salesperson)) { ccwhere.AddComponent("Salesperson", "%" + Salesperson + "%", SearchComponent.Like, SearchPad.And); } string IsDel = Request["IsDel"]; if (!String.IsNullOrEmpty(IsDel)) { ccwhere.AddComponent("IsDel", "1", SearchComponent.Equals, SearchPad.And); } else { ccwhere.AddComponent("Isnull(IsDel,0)", "1", SearchComponent.UnEquals, SearchPad.And); } servComm.strOrderString = "Id"; listObj = servComm.GetListTop <ModelSpec>(0, "[Id],[SaleDate],[seller],[Salesperson],[BillDate],[BillNo],[BillClass],[Reg],[RegTime]", "Sale", ccwhere); string shortName = DateTime.Now.ToString("yyyyMMddHHmmsshhh") + ".xlsx"; string fileName = Request.PhysicalApplicationPath + "UploadFile\\" + shortName; using (NPOIHelper excelHelper = new NPOIHelper(fileName, Request.PhysicalApplicationPath + "UploadFile\\")) { DataTable dtTable = listObj.ToDataTable(); dtTable.Columns.Remove("IsDel"); int count = excelHelper.DataTableToExcel(dtTable, "订单信息", true); } Response.Write("http://" + Request.Url.Authority + "//UploadFile//" + shortName); Response.End(); } else if (Request["actiontype"] == "SaveSpec") { int identityID = 0; try { ModelSpec ModelSpec = new ModelSpec(); if (String.IsNullOrEmpty(Request["Id"])) { ModelSpec.Class = Request["Class"]; ModelSpec.Bh = Request["Bh"]; ModelSpec.ProductName = Request["ProductName"]; ModelSpec.Spec = Request["Spec"]; ModelSpec.OrderNo = Request["OrderNo"]; ModelSpec.Size = Request["Size"]; ModelSpec.exterior = Request["exterior"]; ModelSpec.Color = Request["Color"]; ModelSpec.Remark = Request["Remark"]; identityID = servComm.Add(ModelSpec); } else { if (String.IsNullOrEmpty(Request["Bh"])) { identityID = servComm.ExecuteSql(" delete from Spec where ID in (" + Request["Id"] + ");"); } else { identityID = int.Parse(Request["Id"]); ModelSpec.Class = Request["Class"]; ModelSpec.Bh = Request["Bh"]; ModelSpec.ProductName = Request["ProductName"]; ModelSpec.Spec = Request["Spec"]; ModelSpec.OrderNo = Request["OrderNo"]; ModelSpec.Size = Request["Size"]; ModelSpec.exterior = Request["exterior"]; ModelSpec.Color = Request["Color"]; ModelSpec.Remark = Request["Remark"]; ModelSpec.ID = identityID; int result = servComm.Update(ModelSpec); } } DataCache.dict = servComm.GetListTop <ModelDictDetail>(0, null).ToList(); } catch (Exception ex) { Response.Write(0); Response.End(); } Response.Write(identityID); Response.End(); } }
protected void Page_Load(object sender, EventArgs e) { factoryConnectionString = ConfigurationManager.AppSettings["FactoryConnectString"]; Session["factoryConnectionString"] = factoryConnectionString; facComm = new ServiceCommon(factoryConnectionString); if (!IsPostBack) { if (Request["action"] == null) { Session["productList"] = null; } } if (Request["action"] == "autoNo") { Response.Write(""); Response.End(); } if (Request["action"] == "checkUnique") { Response.Write("0"); Response.End(); } if (Request["action"] == "GetRequireTemplate") { string temlplate = Request["temlplate"]; if (String.IsNullOrEmpty(temlplate)) { Response.Write(""); } else { DataTable dtRequire = servComm.ExecuteSqlDatatable("select RequireTemplateContent from W_RequireTemplate where id =" + temlplate); if (dtRequire.Rows.Count > 0) { Response.Write(dtRequire.Rows[0][0].ToString()); } else { Response.Write(""); } } Response.End(); } BindRequireTemplate(); BindSeller(); if (String.IsNullOrEmpty(yeyRequest.Params("haddinfo")) && !String.IsNullOrEmpty(Request["ModelNo"])) { autoOrderNo.Visible = false; autoLable.Visible = false; ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); ordreModel = servComm.GetListTop <WORDERS>(1, ccWhere)[0]; if (ordreModel.SellerID != 0) { this.ddlSeller.SelectedValue = ordreModel.SellerID.ToString(); } ddlOrderType.Value = ordreModel.OrderClass; //strOtherList ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); IList <WORDERSOTHER> listOther = servComm.GetListTop <WORDERSOTHER>(0, ccWhere); foreach (WORDERSOTHER item in listOther) { strOtherList = strOtherList + ":" + item.Code + "," + item.qty; } if (strOtherList != "") { strOtherList = strOtherList.Substring(1); } servComm.strOrderString = " subId asc "; List <WORDERSDETAIL> listOrders = (List <WORDERSDETAIL>)servComm.GetListTop <WORDERSDETAIL>(0, "*", ccWhere); foreach (WORDERSDETAIL item in listOrders) { string strValue = GetProductName(item.ProductId); if (strValue != "") { item.ItemName = strValue.Split(',')[0]; item.SmallClass = strValue.Split(',')[1]; } } this.repProductList.DataSource = listOrders; this.repProductList.DataBind(); Session["productList"] = listOrders; servComm.strOrderString = ""; ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); IList <WORDERSPHOTOS> listPhotos = servComm.GetListTop <WORDERSPHOTOS>(0, ccWhere); foreach (WORDERSPHOTOS item in listPhotos) { strPhotoList = strPhotoList + "," + item.picpath; } if (strPhotoList != "") { strPhotoList = strPhotoList.Substring(1); } } if (yeyRequest.Params("haddinfo") == "1") { ordreModel.ModelNo = Request["txtModelNo"]; ordreModel.OrderClass = Request[this.ddlOrderType.UniqueID]; ordreModel.SellerID = decimal.Parse(Request[this.ddlSeller.UniqueID]); ordreModel.HospitalID = decimal.Parse(Request[this.ddlHosipital.UniqueID]); ordreModel.DoctorId = decimal.Parse(Request[this.ddlDoctor.UniqueID]); ordreModel.Patient = Request["txtpatient"]; if (Request["txtAge"] != "") { ordreModel.Age = decimal.Parse(Request["txtAge"]); } ordreModel.Sex = Request["ddlSex"]; ordreModel.danzuo = Request["ddlSingle"]; ordreModel.Fenge = Request["ddlDivision"]; ordreModel.Require = Request["Require"].Replace("'", ""); ordreModel.RegTime = DateTime.Now; if (!String.IsNullOrEmpty(yeyRequest.Params("keyID"))) { servComm.Update(ordreModel); } else { servComm.Add(ordreModel); } string AccessoryList = Request["OtherList"]; if (AccessoryList != "") { } string photoList = Request["photoList"]; if (photoList != "") { } int index = 1; IList <WORDERSDETAIL> listOrders = (IList <WORDERSDETAIL>)Session["productList"]; if (listOrders != null) { } Response.Redirect("OrderList.aspx?type=Order"); } }
protected void Page_Load(object sender, EventArgs e) { facComm = new ServiceCommon(factoryConnectionString); if (!IsPostBack) { if (Request["action"] == null) { Session["productList"] = null; } ddlOrderType.DataSource = BindDictClass(facComm, ccWhere, "OrderClass"); ddlOrderType.DataBind(); } if (Request["action"] == "autoNo") { DataTable dtNumber = servComm.ExecuteSqlDatatable("select dbo.fn_GetAutoOrderNo(N'" + LoginUser.UserName + "','" + DateTime.Now.ToString("yyMMdd") + "','" + LoginUser.BelongFactory + "')"); if (dtNumber.Rows.Count > 0) { Response.Write(dtNumber.Rows[0][0].ToString().Trim()); Response.End(); } else { Response.Write(""); Response.End(); } } if (Request["action"] == "checkUnique") { DataTable dtNumber = servComm.ExecuteSqlDatatable("select ModelNo from W_Orders where ModelNo='" + Request["orderNo"].Replace("'", "") + "' and BelongFactory='" + LoginUser.BelongFactory + "'"); if (dtNumber.Rows.Count > 0) { Response.Write("1"); } else { Response.Write("0"); } Response.End(); } if (Request["action"] == "GetRequireTemplate") { string temlplate = Request["temlplate"]; if (String.IsNullOrEmpty(temlplate)) { Response.Write(""); } else { DataTable dtRequire = servComm.ExecuteSqlDatatable("select RequireTemplateContent from W_RequireTemplate where id =" + temlplate); if (dtRequire.Rows.Count > 0) { Response.Write(dtRequire.Rows[0][0].ToString()); } else { Response.Write(""); } } Response.End(); } BindRequireTemplate(); BindSeller(); if (String.IsNullOrEmpty(yeyRequest.Params("haddinfo")) && !String.IsNullOrEmpty(Request["ModelNo"])) { autoOrderNo.Visible = false; autoLable.Visible = false; ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); ordreModel = servComm.GetListTop <WORDERS>(1, ccWhere)[0]; if (ordreModel.SellerID != 0) { this.ddlSeller.SelectedValue = ordreModel.SellerID.ToString(); } ddlOrderType.Value = ordreModel.OrderClass; //strOtherList ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); IList <WORDERSOTHER> listOther = servComm.GetListTop <WORDERSOTHER>(0, ccWhere); foreach (WORDERSOTHER item in listOther) { strOtherList = strOtherList + ":" + item.Code + "," + item.qty; } if (strOtherList != "") { strOtherList = strOtherList.Substring(1); } servComm.strOrderString = " subId asc "; List <WORDERSDETAIL> listOrders = (List <WORDERSDETAIL>)servComm.GetListTop <WORDERSDETAIL>(0, "*", ccWhere); foreach (WORDERSDETAIL item in listOrders) { string strValue = GetProductName(item.ProductId); if (strValue != "") { item.ItemName = strValue.Split(',')[0]; item.SmallClass = strValue.Split(',')[1]; } } this.repProductList.DataSource = listOrders; this.repProductList.DataBind(); Session["productList"] = listOrders; servComm.strOrderString = ""; ccWhere.Clear(); ccWhere.AddComponent("ModelNo", Request["ModelNo"], SearchComponent.Equals, SearchPad.NULL); IList <WORDERSPHOTOS> listPhotos = servComm.GetListTop <WORDERSPHOTOS>(0, ccWhere); foreach (WORDERSPHOTOS item in listPhotos) { strPhotoList = strPhotoList + "," + item.picpath; } if (strPhotoList != "") { strPhotoList = strPhotoList.Substring(1); } } if (yeyRequest.Params("haddinfo") == "1") { ordreModel.ModelNo = Request["txtModelNo"]; ordreModel.OrderClass = Request[this.ddlOrderType.UniqueID]; ordreModel.SellerID = decimal.Parse(Request[this.ddlSeller.UniqueID]); ordreModel.HospitalID = decimal.Parse(Request[this.ddlHosipital.UniqueID]); ordreModel.DoctorId = decimal.Parse(Request[this.ddlDoctor.UniqueID]); ordreModel.Patient = Request["txtpatient"]; if (Request["txtAge"] != "") { ordreModel.Age = decimal.Parse(Request["txtAge"]); } ordreModel.Sex = Request["ddlSex"]; ordreModel.danzuo = Request["ddlSingle"]; ordreModel.Fenge = Request["ddlDivision"]; ordreModel.Require = Request["Require"].Replace("'", ""); ordreModel.RegTime = DateTime.Now; ordreModel.RegName = LoginUser.UserName; ordreModel.BelongFactory = LoginUser.BelongFactory; if (!String.IsNullOrEmpty(yeyRequest.Params("keyID"))) { servComm.Update(ordreModel); } else { servComm.Add(ordreModel); } string AccessoryList = Request["OtherList"]; if (AccessoryList != "") { servComm.ExecuteSql(" delete from W_ordersOther where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'"); string[] otherSplit = AccessoryList.Split(':'); WORDERSOTHER otherModel = new WORDERSOTHER(); ccWhere.Clear(); ccWhere.AddComponent("ClassID", "Accessory", SearchComponent.Equals, SearchPad.NULL); DataTable dtAccessory = facComm.GetListTop(0, "DictDetail", ccWhere); for (int i = 0; i < otherSplit.Length; i++) { string accessoryName = ""; if (dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'").Length > 0) { accessoryName = dtAccessory.Select("Code = '" + otherSplit[i].Split(',')[0] + "'")[0]["DictName"].ToString(); } otherModel.ModelNo = Request["txtModelNo"]; otherModel.SubId = i + 1; otherModel.Code = otherSplit[i].Split(',')[0]; otherModel.name = accessoryName; otherModel.qty = decimal.Parse(otherSplit[i].Split(',')[1]); otherModel.BelongFactory = LoginUser.BelongFactory; servComm.Add(otherModel); } } string photoList = Request["photoList"]; if (photoList != "") { servComm.ExecuteSql(" delete from W_OrderPhotos where ModelNo='" + Request["txtModelNo"] + "' and BelongFactory = '" + LoginUser.BelongFactory + "'"); string[] otherSplit = photoList.Split(','); WORDERSPHOTOS photoModel = new WORDERSPHOTOS(); for (int i = 0; i < otherSplit.Length; i++) { photoModel.ModelNo = Request["txtModelNo"]; photoModel.SubId = i + 1; photoModel.picpath = otherSplit[i].Split(',')[0]; photoModel.BelongFactory = LoginUser.BelongFactory; servComm.Add(photoModel); } } int index = 1; IList <WORDERSDETAIL> listOrders = (IList <WORDERSDETAIL>)Session["productList"]; if (listOrders != null) { servComm.ExecuteSql(" delete from W_OrdersDetail where ModelNo='" + Request["txtModelNo"] + "'and BelongFactory = '" + LoginUser.BelongFactory + "'"); foreach (WORDERSDETAIL item in listOrders) { item.subId = index; item.ModelNo = Request["txtModelNo"]; item.BelongFactory = LoginUser.BelongFactory; servComm.Add(item); index = index + 1; } } Response.Redirect("OrderList.aspx?type=Order"); } }