public void FindDrawing() { string partCode = Context.Request.Form["partCode"]; string custCode = Context.Request.Form["custCode"]; string startTime = Context.Request.Form["startTime"]; string endTime = Context.Request.Form["endTime"]; string rows = Context.Request.Form["rows"]; string page = Context.Request.Form["page"]; IList <PartsdrawingCode> objs = _bal.FindDrawing(partCode, custCode, startTime, endTime); List <PartsdrawingCode> bs = new List <PartsdrawingCode>(); int istart = (Convert.ToInt32(page) - 1) * Convert.ToInt32(rows); int iend = Convert.ToInt32(page) * Convert.ToInt32(rows) + 1; int j = 1; foreach (PartsdrawingCode bb in objs) { if (j > istart && j < iend) { PartsdrawingCode bbtemp = new PartsdrawingCode(); bbtemp = bb; bbtemp.UpdatedBy = FindUserNameByCode(bbtemp.UpdatedBy); bs.Add(bbtemp); } j++; } Dictionary <String, Object> map = new Dictionary <String, Object>(); //if (objs != null & objs.Count > 0) //{ map.Add("total", objs.Count); map.Add("rows", objs); //} Context.Response.Write(JsonConvert.SerializeObject(map)); }
protected bool SaveToDB(string path, string tablename) { try { DataTable dt = ExcelManage.InputFromExcel(path, tablename); if (dt != null && dt.Rows.Count > 0) { WsSystem wbi = new WsSystem(); for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i][0].ToString())) { PartsdrawingCode bb = new PartsdrawingCode(); bb.ID = PubHelper.GetHelper().GetNextID("MES_MASTER.SEQ_ALL_ID").ToString(); bb.PartsCode = dt.Rows[i][0].ToString(); bb.CustName = dt.Rows[i][1].ToString(); bb.CustCode = dt.Rows[i][2].ToString(); bb.ProductName = dt.Rows[i][3].ToString(); bb.ProductCode = dt.Rows[i][4].ToString(); bb.PlanQuantity = Convert.ToDecimal(dt.Rows[i][5].ToString()); bb.QualityCode = dt.Rows[i][6].ToString(); bb.AskQuantity = Convert.ToDecimal(dt.Rows[i][7].ToString()); bb.BatchNumber = dt.Rows[i][8].ToString(); bb.AskDate = Convert.ToDateTime(dt.Rows[i][9].ToString()); bb.ACTIVE = "1"; wbi.SavePartsDrawing(bb); } } return(true); } else { Label1.Text = "上传完毕,但数据为空,保存失败"; } return(true); } catch (Exception ex) { Label1.Text = ex.ToString(); return(false); } }