public string GetBjformDetail() { string responsetxt = string.Empty; DataTable dt; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["code"]; string TypeStr = context.Request.Params["type"]; string sqlStr = string.Empty; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr) }; if (TypeStr == "材料") { sqlStr = "select a.pcode, b.Description as pdesc, b.size, b.unit, a.purchaseamount,a.checkrate, a.checkamount,a.passamount,a.passrate,a.finalpassamount, convert(varchar(20), a.checkdate, 120) as checkdate from bjform_d a, stockinfo b where a.pcode = b.code and a.code =@code"; } else { sqlStr = "select Description as pdesc, size, unit,purchaseamount,checkrate,checkamount, passamount,passrate, finalpassamount,convert(varchar(20), checkdate, 120) as checkdate from bjform_d_others where code = @code"; } dt = KDATA.GetDataTable(sqlStr, spara); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string GetDataFromStockinfo() { //HttpContextBase context = this.HttpContext; // NameValueCollection forms = context.Request.Form; DataTable dt = KDATA.GetDataTable("select code,codetype,productmodel from barcodeelement "); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string GetQcProcessFormInfo() { HttpContextBase context = this.HttpContext; string StatusStr = context.Request.Params["status"]; string sqlStr = string.Empty; string userSQLStr = string.Empty; DataTable dt; if (Session["role"].ToString() == "1") { userSQLStr = " where a.status in ('2','3','4') and a.qcstaff='" + Session["user"].ToString() + "'"; } else { userSQLStr = " where a.status in ('1','2','3','4')"; } if (StatusStr == null) { sqlStr = @"select a.urgent,f.bjtext as type,a.code,e.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, b.bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username left join QC_staff e on a.maker=e.username left join bjformstcode f on a.type=f.bjstatus" + userSQLStr + "order by a.makedate desc"; try { dt = KDATA.GetDataTable(sqlStr); }catch (Exception ex) { throw ex; } } else { SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@status", StatusStr) }; sqlStr = @"select a.code,a.maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username where status=@status order by a.makedate desc"; try { dt = KDATA.GetDataTable(sqlStr, spara); }catch (Exception ex) { throw ex; } } return(JsonConvert.SerializeObject(dt)); }
public string GetBjFrominfo() { string sqlStr = @"select a.urgent,f.bjtext as type,a.code,e.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as maker,a.buyer,a.supplier,c.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcmanager, d.profile.value('(/root/Chinesename)[1]', 'nvarchar(max)') as qcstaff, b.bjtext as status,convert(varchar(20), a.makedate, 120) as makedate from bjform_m a left join bjformstcode b on a.status = b.bjstatus left join QC_staff c on a.qcmanager = c.username left join QC_staff d on a.qcstaff = d.username left join QC_staff e on a.maker=e.username left join bjformstcode f on a.type=f.bjstatus order by a.makedate desc"; DataTable dt = KDATA.GetDataTable(sqlStr); string returnjson = JsonConvert.SerializeObject(dt); return(returnjson); }
public string GetStatusForQc() { string responsetxt = "<select>"; DataTable dt = KDATA.GetDataTable("select bjtext from bjformstcode where bjstatus in ('1','2','4')"); for (int i = 0; i < dt.Rows.Count; i++) { responsetxt += "<option value='" + dt.Rows[i]["bjtext"] + "'>" + dt.Rows[i]["bjtext"] + "</option>"; } responsetxt += "</select>"; return(responsetxt); }
public string GetStockinfoDetail() { string returnjson = string.Empty; HttpContextBase context = this.HttpContext; string SearchStr = context.Request.Params["q"]; if (SearchStr != null) { string sqlstr = "select code as pcode,description as [desc],size,unit from stockinfo where code='" + SearchStr + "'"; DataTable dt = KDATA.GetDataTable(sqlstr); returnjson = JsonConvert.SerializeObject(dt); } return(returnjson); }
public string SearchStockinfo() { string returnjson = string.Empty; HttpContextBase context = this.HttpContext; string SearchStr = context.Request.Params["q"]; if (SearchStr != null) { string sqlstr = "select code as id, description+' '+size as text from stockinfo where description like '%" + SearchStr.Trim() + "%' or size like '%" + SearchStr.Trim() + "%'"; DataTable dt = KDATA.GetDataTable(sqlstr); returnjson = JsonConvert.SerializeObject(dt); } return(returnjson); }
public string GetUsername() { HttpContextBase context = this.HttpContext; string roleid = "9"; string responsetxt = "<select>"; DataTable dt = KDATA.GetDataTable("select username,profile.value('(/root/Chinesename)[1]','nvarchar(max)') as chinesename from QC_staff where role=" + roleid + " order by username asc"); for (int i = 0; i < dt.Rows.Count; i++) { responsetxt += "<option value = '" + dt.Rows[i]["chinesename"] + "'>" + dt.Rows[i]["chinesename"] + "</option >"; } responsetxt += "</select>"; return(responsetxt); }
public string GetqcitemDetail() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; string CodeStr = context.Request.Params["bjformcode"].Trim(); string TypeStr = context.Request.Params["bjformtype"].Trim(); string ItemStr = context.Request.Params["bjformitem"].Trim(); string sqlStr = string.Empty; DataTable dt; SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@code", CodeStr), new SqlParameter("@pcode", ItemStr) }; if (TypeStr == "材料") { sqlStr = @"select a.code,a.pcode,a.checkamount,b.Description,b.Size,b.Unit,a.purchaseamount,a.checkamount,a.checkrate,a.passamount,a.finalpassamount,a.passrate,a.note.value('(/root/staffnote)[1]','varchar(max)') as staffnote,a.note.value('(/root/directornote)[1]','varchar(max)') as directornote from bjform_d a, stockinfo b where a.pcode = b.code and a.code = @code and a.pcode = @pcode"; } else { sqlStr = @"select code,Description,Size,Unit,purchaseamount,checkamount,checkrate,passamount,finalpassamount,passrate,note.value('(/root/staffnote)[1]','varchar(max)') as staffnote,note.value('(/root/directornote)[1]','varchar(max)') as directornote from bjform_d_others where code=@code and description=@pcode"; } try { dt = KDATA.GetDataTable(sqlStr, spara); }catch (Exception ex) { throw ex; } responsetxt = JsonConvert.SerializeObject(dt); return(responsetxt); }
public string UserCheck() { string responsetxt = string.Empty; HttpContextBase context = this.HttpContext; /*string SubmitStr = context.Request.Params["submit"]; * * JObject jo = (JObject)JsonConvert.DeserializeObject(SubmitStr); * * string userStr = jo["username"].ToString(); * string passStr =Hash_MD5_32( jo["password"].ToString()); */ string userStr = context.Request.Params["userdata"]; string passStr = Hash_MD5_32(context.Request.Params["passdata"]); DataTable dt; Dictionary <string, string> responsejsontxt = new Dictionary <string, string>(); SqlParameter[] spara = new SqlParameter[] { new SqlParameter("@user", userStr), new SqlParameter("@pass", passStr) }; try { dt = KDATA.GetDataTable(@"select top 1 username,profile.value('(/root/Chinesename)[1]','varchar(max)') as chinesename,role from QC_staff where username=@user and password=@pass", spara); }catch (Exception ex) { throw ex; } if (dt.Rows.Count > 0) { Session["user"] = dt.Rows[0]["username"].ToString(); Session["chinesename"] = dt.Rows[0]["chinesename"].ToString(); Session["role"] = dt.Rows[0]["role"].ToString().Trim(); responsejsontxt.Add("restxt", "loginsuccess"); string urlheader = Request.ApplicationPath.Length == 1 ? string.Empty : Request.ApplicationPath; switch (dt.Rows[0]["role"].ToString().Trim()) { case "0": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; case "1": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; case "9": responsejsontxt.Add("url", urlheader + "/Qcform"); break; case "99": responsejsontxt.Add("url", urlheader + "/Qcprocess"); break; default: responsejsontxt.Add("url", urlheader + "/"); break; } } else { responsejsontxt.Add("restxt", "loginerror"); responsejsontxt.Add("url", Request.ApplicationPath + "/Login"); } responsetxt = JsonConvert.SerializeObject(responsejsontxt); return(responsetxt); }