コード例 #1
0
        public string BjFormChgStatus()
        {
            string          responsetxt = string.Empty;
            HttpContextBase context     = this.HttpContext;
            string          CodeStr     = context.Request.Params["code"];
            string          StatusStr   = context.Request.Params["chgstatus"];

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", CodeStr),
                new SqlParameter("@chgstatus", StatusStr)
            };
            try
            {
                int resultcode = KDATA.ExecuteNonQuery("update bjform_m set status=@chgstatus where code=@code", spara);
                if (resultcode > 0)
                {
                    responsetxt = "success";
                }
                else
                {
                    responsetxt = "error";
                }
            }catch (Exception ex)
            {
                throw ex;
            }

            return(responsetxt);
        }
コード例 #2
0
        public string DelBjForm()
        {
            string          responsetxt = string.Empty;
            HttpContextBase context     = this.HttpContext;
            string          codeStr     = context.Request.Params["code"];

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", codeStr)
            };
            try
            {
                int resultcode = KDATA.ExecuteNonQuery("delete bjform_m where status=0 and code=@code", spara);
                if (resultcode > 0)
                {
                    responsetxt = "已删除报检单";
                }
                else
                {
                    responsetxt = "删除有误";
                }
            }catch (Exception ex)
            {
                throw ex;
            }

            return(responsetxt);
        }
コード例 #3
0
        public void UpdateBjfrom(NameValueCollection forms, out string responsetxt)
        {
            string code     = forms.Get("code").ToString().Trim();
            string buyer    = forms.Get("buyer").ToString();
            string supplier = forms.Get("supplier").ToString();

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", code),
                new SqlParameter("@buyer", buyer),
                new SqlParameter("@supplier", supplier)
            };

            try
            {
                int resultcode = KDATA.ExecuteNonQuery("update bjform_m set buyer=@buyer,supplier=@supplier where code=@code", spara);
                if (resultcode > 0)
                {
                    responsetxt = "已保存";
                }
                else
                {
                    responsetxt = "保存有误,联系管理员";
                }
            } catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
        public string AddBjFormDetail()
        {
            string          responsetxt = string.Empty;
            HttpContextBase context     = this.HttpContext;
            string          CodeStr     = context.Request.Params["code"];
            string          TypeStr     = context.Request.Params["ptype"];
            string          PcodeStr    = context.Request.Params["pcode"];
            string          PdescStr    = context.Request.Params["pdesc"];
            string          PsizeStr    = context.Request.Params["psize"];
            string          PunitStr    = context.Request.Params["punit"];
            float           Checkamount = Convert.ToSingle(context.Request.Params["puramount"]);
            string          sqlStr      = string.Empty;



            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", CodeStr),
                new SqlParameter("@pcode", PcodeStr),
                new SqlParameter("@desc", PdescStr),
                new SqlParameter("@size", PsizeStr),
                new SqlParameter("@unit", PunitStr),
                new SqlParameter("@purchaseamount", Checkamount)
            };

            if (TypeStr == "80")
            {
                sqlStr = "insert into bjform_d (code, pcode, purchaseamount) values(@code, @pcode, @purchaseamount)";
            }
            else
            {
                sqlStr = "insert into bjform_d_others (code,description,size,unit,purchaseamount) values (@code,@desc,@size,@unit,@purchaseamount)";
            }

            try
            {
                int resultcode = KDATA.ExecuteNonQuery(sqlStr, spara);
                if (resultcode > 0)
                {
                    responsetxt = "已保存";
                }
                else
                {
                    responsetxt = "保存有误,联系管理员";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(responsetxt);
        }
コード例 #5
0
        public string DelBjFormDetail()
        {
            string          responsetxt = string.Empty;
            HttpContextBase context     = this.HttpContext;
            string          codestr     = context.Request.Params["code"];
            string          typestr     = context.Request.Params["type"];
            string          pcodestr    = context.Request.Params["pcode"];

            string[] pcodearray = pcodestr.Split('|');
            string   pcodesql   = string.Empty;
            string   tablesql   = string.Empty;

            foreach (string pcode in pcodearray)
            {
                pcodesql = pcodesql + ",'" + pcode + "'";
            }
            pcodesql = pcodesql.Substring(1);

            if (typestr == "材料")
            {
                tablesql = "delete bjform_d where code='" + codestr.Trim() + "' and pcode in (" + pcodesql + ")";
            }
            else
            {
                tablesql = "delete bjform_d_others where code='" + codestr.Trim() + "' and description in (" + pcodesql + ")";
            }

            try
            {
                int resultcode = KDATA.ExecuteNonQuery(tablesql);
                if (resultcode > 0)
                {
                    responsetxt = "已保存";
                }
                else
                {
                    responsetxt = "保存有误,联系管理员";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(responsetxt);
        }
コード例 #6
0
        public void AddBjForm(NameValueCollection forms, out string responsetxt)
        {
            string bjformcode = forms.Get("code").ToString();
            string urgent     = forms.Get("urgent").ToString();
            string type       = forms.Get("type").ToString();
            string maker      = forms.Get("maker").ToString();
            string buyer      = forms.Get("buyer").ToString();
            string supplier   = forms.Get("supplier").ToString();
            string status     = "0";
            string makedate   = forms.Get("makedate").ToString();

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", bjformcode),
                new SqlParameter("@urgent", urgent),
                new SqlParameter("@type", type),
                new SqlParameter("@maker", maker),
                new SqlParameter("@buyer", buyer),
                new SqlParameter("@supplier", supplier),
                new SqlParameter("@status", status),
                new SqlParameter("@makedate", makedate)
            };

            try
            {
                int resultcode = KDATA.ExecuteNonQuery(@"insert into bjform_m (urgent,type,code,maker,buyer,supplier,status,makedate) 
                                                                               values (@urgent,@type,@code,
                                                                               (select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')=@maker) ,
                                                                               @buyer,@supplier,@status,@makedate)", spara);
                if (resultcode > 0)
                {
                    responsetxt = "已保存";
                }
                else
                {
                    responsetxt = "保存有误,联系管理员";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        public void UpdateBjfromByQc(NameValueCollection forms, out string responsetxt)
        {
            string codeStr      = forms.Get("code").Trim();
            string qcmanagerStr = forms.Get("qcmanager");
            string qcstaffStr   = forms.Get("qcstaff");
            string statusStr    = forms.Get("status");

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", codeStr),
                new SqlParameter("@manager", qcmanagerStr),
                new SqlParameter("@staff", qcstaffStr),
                new SqlParameter("@status", statusStr)
            };

            try
            {
                string sqlstr = "update bjform_m ";
                sqlstr += "set qcstaff=(select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')='" + qcstaffStr + "'),";
                sqlstr += "qcmanager=(select top 1 username from qc_staff where profile.value('(/root/Chinesename)[1]','nvarchar(max)')='" + qcmanagerStr + "'),";
                sqlstr += "status=(select top 1 bjstatus from bjformstcode where bjtext='" + statusStr + "') ";
                sqlstr += "where code='" + codeStr + "'";
                int resultcode = KDATA.ExecuteNonQuery(sqlstr);
                if (resultcode > 0)
                {
                    responsetxt = "success";
                }
                else
                {
                    responsetxt = "error";
                }
            }catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        public string Updateqcitem()
        {
            string          responsetxt = string.Empty;
            HttpContextBase context     = this.HttpContext;
            string          SubmitStr   = context.Request.Params["submit"];

            JObject jo = (JObject)JsonConvert.DeserializeObject(SubmitStr);

            string codestr  = jo["code"].ToString();
            string pcodestr = string.Empty;

            if (jo["pcode"] != null)
            {
                pcodestr = jo["pcode"].ToString();
            }
            else
            {
                pcodestr = jo["desc"].ToString();
            }
            decimal checkamount     = Convert.ToDecimal(jo["checkamount"]);
            decimal passamount      = Convert.ToDecimal(jo["passamount"]);
            decimal finalpassamount = Convert.ToDecimal(jo["finalpassamount"]);
            decimal checkrate       = Convert.ToDecimal(jo["checkrate"].ToString().TrimEnd('%')) / 100;
            decimal passrate        = Convert.ToDecimal(jo["passrate"].ToString().TrimEnd('%')) / 100;
            string  qcnotestr       = jo["qcnote"].ToString();
            string  directornotestr = jo["directornote"].ToString();
            string  checkdatestr    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            XmlDocument xdoc;
            XmlElement  xelement;


            xdoc     = new XmlDocument();
            xelement = xdoc.CreateElement("", "root", "");
            xdoc.AppendChild(xelement);

            XmlElement staffnote = xdoc.CreateElement("staffnote");

            staffnote.InnerText = qcnotestr;
            XmlElement directornote = xdoc.CreateElement("directornote");

            directornote.InnerText = directornotestr;

            xelement.AppendChild(staffnote);
            xelement.AppendChild(directornote);
            string notestr = xdoc.OuterXml;

            SqlParameter[] spara = new SqlParameter[]
            {
                new SqlParameter("@code", codestr),
                new SqlParameter("@pcode", pcodestr),
                new SqlParameter("@checkamount", checkamount),
                new SqlParameter("@passamount", passamount),
                new SqlParameter("@finalpassamount", finalpassamount),
                new SqlParameter("@checkrate", checkrate),
                new SqlParameter("@passrate", passrate),
                new SqlParameter("@note", notestr),
                new SqlParameter("@checkdate", checkdatestr)
            };

            string sqlStr = string.Empty;

            if (jo["pcode"] == null)
            {
                sqlStr = @"update bjform_d_others set checkamount=@checkamount,passamount=@passamount,finalpassamount=@finalpassamount,checkrate=@checkrate,passrate=@passrate,note=@note,checkdate=@checkdate 
                                        where code=@code and description=@pcode";
            }
            else
            {
                sqlStr = @"update bjform_d set checkamount=@checkamount,passamount=@passamount,finalpassamount=@finalpassamount,checkrate=@checkrate,passrate=@passrate,note=@note,checkdate=@checkdate 
                                                                               where code=@code and pcode=@pcode";
            }

            try
            {
                int resultcode = KDATA.ExecuteNonQuery(sqlStr, spara);
                if (resultcode > 0)
                {
                    responsetxt = "updateqcitemsuccess";
                }
                else
                {
                    responsetxt = "error";
                }
            } catch (Exception ex)
            {
                throw ex;
            }

            return(responsetxt);
        }