예제 #1
0
        public int addTran(VAN_OA.Model.ReportForms.TB_SupplierInfo model, VAN_OA.Model.EFrom.tb_EForm eform)
        {
            int id = 0;

            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlTransaction tan        = conn.BeginTransaction();
                SqlCommand     objCommand = conn.CreateCommand();
                objCommand.Transaction = tan;
                try
                {
                    objCommand.Parameters.Clear();
                    model.Status = eform.state;
                    tb_EFormService eformSer = new tb_EFormService();
                    string          proNo    = eformSer.GetAllE_No("TB_SupplierInfo", objCommand);
                    model.ProNo   = proNo;
                    eform.E_No    = proNo;
                    id            = Add(model, objCommand);
                    eform.allE_id = id;
                    eformSer.Add(eform, objCommand);

                    tan.Commit();
                }
                catch (Exception)
                {
                    tan.Rollback();
                    return(0);
                }
                return(id);
            }
        }
예제 #2
0
        private void ShowInfo(int Id)
        {
            VAN_OA.Model.ReportForms.TB_SupplierInfo model = supplierSer.GetModel(Id);

            this.txtTime.Text         = model.Time.ToString();
            this.txtSupplierName.Text = model.SupplierName;
            this.txtPhone.Text        = model.Phone;
            this.txtLikeMan.Text      = model.LikeMan;
            this.txtJob.Text          = model.Job;
            this.txtFoxOrEmail.Text   = model.FoxOrEmail;
            this.chkIfSave.Checked    = model.IfSave;
            this.txtQQMsn.Text        = model.QQMsn;

            this.txtSupplierId.Text        = model.SupplierId;
            this.txtSupplierAddress.Text   = model.SupplierAddress;
            this.txtSupplierHttp.Text      = model.SupplierHttp;
            this.txtSupplierShui.Text      = model.SupplierShui;
            this.txtSupplierGong.Text      = model.SupplierGong;
            this.txtSupplierBrandNo.Text   = model.SupplierBrandNo;
            this.txtSupplierBrandName.Text = model.SupplierBrandName;
            txtRemark.Text             = model.Remark;
            txtSupplierSimpleName.Text = model.SupplieSimpeName;
            txtMainRange.Text          = model.MainRange;
            txtZhuJi.Text = model.ZhuJi;
            lblProNo.Text = model.ProNo;
        }
예제 #3
0
        public bool updateTran(VAN_OA.Model.ReportForms.TB_SupplierInfo model, VAN_OA.Model.EFrom.tb_EForm eform, tb_EForms forms)
        {
            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlTransaction tan        = conn.BeginTransaction();
                SqlCommand     objCommand = conn.CreateCommand();
                objCommand.Transaction = tan;
                try
                {
                    objCommand.Parameters.Clear();
                    model.Status = eform.state;
                    Update(model, objCommand);


                    tb_EFormService eformSer = new tb_EFormService();

                    eformSer.Update(eform, objCommand);


                    tb_EFormsService eformsSer = new tb_EFormsService();
                    eformsSer.Add(forms, objCommand);

                    tan.Commit();
                }
                catch (Exception)
                {
                    tan.Rollback();
                    return(false);
                }
            }

            return(true);
        }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public VAN_OA.Model.ReportForms.TB_SupplierInfo GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" Peculiarity,City,Province,TB_SupplierInfo.Id,Time,SupplierName,Phone,LikeMan,Job,FoxOrEmail,IfSave,QQMsn,FristMeet,SecondMeet,FaceMeet,Price,IfSuccess,MyAppraise,ManAppraise,CreateUser,CreateTime,tb_User.loginName,ZhuJi,IsSpecial");
            strSql.Append(",SupplierId,SupplierAddress,SupplierHttp,SupplierShui,SupplierGong,SupplierBrandNo,SupplierBrandName,Remark ,ProNo");
            strSql.Append(",SupplieSimpeName,Status,MainRange,IsUse");
            strSql.Append(" from TB_SupplierInfo left join tb_User on TB_SupplierInfo.CreateUser=tb_User.ID");
            strSql.Append(" where TB_SupplierInfo.Id=" + Id + "");

            VAN_OA.Model.ReportForms.TB_SupplierInfo model = null;
            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(strSql.ToString(), conn);
                using (SqlDataReader objReader = objCommand.ExecuteReader())
                {
                    if (objReader.Read())
                    {
                        model = ReaderBind(objReader);
                    }
                }
            }
            return(model);
        }
예제 #5
0
        public List <VAN_OA.Model.ReportForms.TB_SupplierInfo> GetSupplierListToQuery(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  TB_SupplierInfo.Id,");
            strSql.Append(" SupplierName,SupplierId ");
            strSql.Append(" from TB_SupplierInfo ");


            strSql.Append(string.Format(@" where Status='通过' "));



            strSql.Append(strWhere);


            strSql.Append(" order by SupplierId, SupplierName");
            List <VAN_OA.Model.ReportForms.TB_SupplierInfo> list = new List <VAN_OA.Model.ReportForms.TB_SupplierInfo>();

            using (SqlConnection conn = DBHelp.getConn())
            {
                conn.Open();
                SqlCommand objCommand = new SqlCommand(strSql.ToString(), conn);
                using (SqlDataReader objReader = objCommand.ExecuteReader())
                {
                    while (objReader.Read())
                    {
                        VAN_OA.Model.ReportForms.TB_SupplierInfo model = new VAN_OA.Model.ReportForms.TB_SupplierInfo();
                        model.SupplierName = objReader["SupplierName"].ToString();
                        object ojb = objReader["SupplierId"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.SupplierId = ojb.ToString();
                        }



                        ojb = objReader["Id"];
                        if (ojb != null && ojb != DBNull.Value)
                        {
                            model.Id = (int)ojb;
                        }



                        list.Add(model);
                    }
                }
            }
            return(list);
        }
예제 #6
0
        private void ShowInfo(int Id)
        {
            VAN_OA.Model.ReportForms.TB_SupplierInfo model = supplierSer.GetModel(Id);

            this.txtTime.Text         = model.Time.ToString();
            this.txtSupplierName.Text = model.SupplierName;
            this.txtPhone.Text        = model.Phone;
            this.txtLikeMan.Text      = model.LikeMan;
            this.txtJob.Text          = model.Job;
            this.txtFoxOrEmail.Text   = model.FoxOrEmail;
            this.chkIfSave.Checked    = model.IfSave;
            this.txtQQMsn.Text        = model.QQMsn;

            this.txtSupplierId.Text        = model.SupplierId;
            this.txtSupplierAddress.Text   = model.SupplierAddress;
            this.txtSupplierHttp.Text      = model.SupplierHttp;
            this.txtSupplierShui.Text      = model.SupplierShui;
            this.txtSupplierGong.Text      = model.SupplierGong;
            this.txtSupplierBrandNo.Text   = model.SupplierBrandNo;
            this.txtSupplierBrandName.Text = model.SupplierBrandName;
            txtSupplierSimpleName.Text     = model.SupplieSimpeName;
            txtRemark.Text      = model.Remark;
            lblProNo.Text       = model.ProNo;
            lblCreateTime.Text  = model.CreateTime.ToShortDateString().ToString();
            lblCreateUser.Text  = model.UserName;
            txtMainRange.Text   = model.MainRange;
            txtZhuJi.Text       = model.ZhuJi;
            cbIsUse.Checked     = model.IsUse;
            cbIsSpecial.Checked = model.IsSpecial;
            ddlProvince.Text    = model.Province;
            ddlPeculiarity.Text = model.Peculiarity;
            //if (!string.IsNullOrEmpty(model.Province))
            //{
            Province_CityService proList = new Province_CityService();
            var cityList = proList.CityList(model.Province);

            cityList.Insert(0, "");
            ddlCity.DataSource = cityList;
            ddlCity.DataBind();
            ddlCity.Text = model.City;
            //}
        }
예제 #7
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (this.FormCheck())
            {
                try
                {
                    string sql = string.Format("select COUNT(*) from TB_SupplierInfo where SupplieSimpeName='{1}' and Id<>{0}", Request["Id"], txtSupplierName.Text);
                    if (Convert.ToInt32(DBHelp.ExeScalar(sql)) > 0)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('供应商名称已经存在!');</script>");
                    }
                    DateTime Time              = DateTime.Parse(this.txtTime.Text);
                    string   SupplierName      = this.txtSupplierName.Text;
                    string   Phone             = this.txtPhone.Text;
                    string   LikeMan           = this.txtLikeMan.Text;
                    string   Job               = this.txtJob.Text;
                    string   FoxOrEmail        = this.txtFoxOrEmail.Text;
                    bool     IfSave            = this.chkIfSave.Checked;
                    string   QQMsn             = this.txtQQMsn.Text;
                    string   SupplierId        = this.txtSupplierId.Text;
                    string   SupplierAddress   = this.txtSupplierAddress.Text;
                    string   SupplierHttp      = this.txtSupplierHttp.Text;
                    string   SupplierShui      = this.txtSupplierShui.Text;
                    string   SupplierGong      = this.txtSupplierGong.Text;
                    string   SupplierBrandNo   = this.txtSupplierBrandNo.Text;
                    string   SupplierBrandName = this.txtSupplierBrandName.Text;

                    string Remark = this.txtRemark.Text;



                    int      CreateUser = Convert.ToInt32(Session["currentUserId"]);
                    DateTime CreateTime = DateTime.Now;

                    VAN_OA.Model.ReportForms.TB_SupplierInfo model = new VAN_OA.Model.ReportForms.TB_SupplierInfo();
                    model.Time         = Time;
                    model.SupplierName = SupplierName;
                    model.Phone        = Phone;
                    model.LikeMan      = LikeMan;
                    model.Job          = Job;
                    model.FoxOrEmail   = FoxOrEmail;
                    model.IfSave       = IfSave;
                    model.QQMsn        = QQMsn;
                    model.CreateUser   = CreateUser;
                    model.CreateTime   = CreateTime;

                    model.SupplierId        = SupplierId;
                    model.SupplierAddress   = SupplierAddress;
                    model.SupplierHttp      = SupplierHttp;
                    model.SupplierShui      = SupplierShui;
                    model.SupplierGong      = SupplierGong;
                    model.SupplierBrandNo   = SupplierBrandNo;
                    model.SupplierBrandName = SupplierBrandName;
                    model.Remark            = Remark;
                    model.SupplieSimpeName  = txtSupplierSimpleName.Text;
                    model.Id               = Convert.ToInt32(base.Request["Id"]);
                    model.MainRange        = txtMainRange.Text;
                    model.SupplieSimpeName = txtSupplierSimpleName.Text;
                    model.ZhuJi            = txtZhuJi.Text;
                    if (this.supplierSer.Update(model))
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>");
                    }
                    else
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
                }
            }
        }
예제 #8
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.FormCheck())
            {
                try
                {
                    DateTime Time         = DateTime.Parse(this.txtTime.Text);
                    string   SupplierName = this.txtSupplierName.Text;
                    string   Phone        = this.txtPhone.Text;
                    string   LikeMan      = this.txtLikeMan.Text;
                    string   Job          = this.txtJob.Text;
                    string   FoxOrEmail   = this.txtFoxOrEmail.Text;
                    bool     IfSave       = this.chkIfSave.Checked;
                    string   QQMsn        = this.txtQQMsn.Text;

                    string   SupplierId        = this.txtSupplierId.Text;
                    string   SupplierAddress   = this.txtSupplierAddress.Text;
                    string   SupplierHttp      = this.txtSupplierHttp.Text;
                    string   SupplierShui      = this.txtSupplierShui.Text;
                    string   SupplierGong      = this.txtSupplierGong.Text;
                    string   SupplierBrandNo   = this.txtSupplierBrandNo.Text;
                    string   SupplierBrandName = this.txtSupplierBrandName.Text;
                    string   Remark            = this.txtRemark.Text;
                    int      CreateUser        = Convert.ToInt32(Session["currentUserId"]);
                    DateTime CreateTime        = DateTime.Now;

                    VAN_OA.Model.ReportForms.TB_SupplierInfo model = new VAN_OA.Model.ReportForms.TB_SupplierInfo();
                    model.Time         = Time;
                    model.SupplierName = SupplierName;
                    model.Phone        = Phone;
                    model.LikeMan      = LikeMan;
                    model.Job          = Job;
                    model.FoxOrEmail   = FoxOrEmail;
                    model.IfSave       = IfSave;
                    model.QQMsn        = QQMsn;
                    model.CreateUser   = CreateUser;
                    model.CreateTime   = CreateTime;


                    model.SupplierId        = SupplierId;
                    model.SupplierAddress   = SupplierAddress;
                    model.SupplierHttp      = SupplierHttp;
                    model.SupplierShui      = SupplierShui;
                    model.SupplierGong      = SupplierGong;
                    model.SupplierBrandNo   = SupplierBrandNo;
                    model.SupplierBrandName = SupplierBrandName;

                    model.Remark           = Remark;
                    model.MainRange        = txtMainRange.Text;
                    model.SupplieSimpeName = txtSupplierSimpleName.Text;
                    model.ZhuJi            = txtZhuJi.Text;
                    if (this.supplierSer.Add(model) > 0)
                    {
                        base.Response.Redirect(Session["POUrl"].ToString());
                    }
                    else
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
                }
            }
        }
예제 #9
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FormCheck())
            {
                btnSub.Enabled = false;
                if (base.Request["ProId"] != null)
                {
                    #region 获取单据基本信息

                    DateTime Time         = DateTime.Parse(this.txtTime.Text);
                    string   SupplierName = this.txtSupplierName.Text.Trim();
                    string   Phone        = this.txtPhone.Text;
                    string   LikeMan      = this.txtLikeMan.Text;
                    string   Job          = this.txtJob.Text;
                    string   FoxOrEmail   = this.txtFoxOrEmail.Text;
                    bool     IfSave       = this.chkIfSave.Checked;
                    string   QQMsn        = this.txtQQMsn.Text;

                    string   SupplierId        = this.txtSupplierId.Text;
                    string   SupplierAddress   = this.txtSupplierAddress.Text;
                    string   SupplierHttp      = this.txtSupplierHttp.Text;
                    string   SupplierShui      = this.txtSupplierShui.Text.Trim();
                    string   SupplierGong      = this.txtSupplierGong.Text.Trim();
                    string   SupplierBrandNo   = this.txtSupplierBrandNo.Text.Trim();
                    string   SupplierBrandName = this.txtSupplierBrandName.Text.Trim();
                    string   Remark            = this.txtRemark.Text;
                    int      CreateUser        = Convert.ToInt32(DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", lblCreateUser.Text)));
                    DateTime CreateTime        = DateTime.Now;
                    VAN_OA.Model.ReportForms.TB_SupplierInfo model = new VAN_OA.Model.ReportForms.TB_SupplierInfo();
                    model.SupplieSimpeName = txtSupplierSimpleName.Text.Trim();
                    model.Time             = Time;
                    model.SupplierName     = SupplierName;
                    model.Phone            = Phone;
                    model.LikeMan          = LikeMan;
                    model.Job               = Job;
                    model.FoxOrEmail        = FoxOrEmail;
                    model.IfSave            = IfSave;
                    model.QQMsn             = QQMsn;
                    model.CreateUser        = CreateUser;
                    model.CreateTime        = CreateTime;
                    model.SupplierId        = SupplierId;
                    model.SupplierAddress   = SupplierAddress;
                    model.SupplierHttp      = SupplierHttp;
                    model.SupplierShui      = SupplierShui;
                    model.SupplierGong      = SupplierGong;
                    model.SupplierBrandNo   = SupplierBrandNo;
                    model.SupplierBrandName = SupplierBrandName;
                    model.Remark            = Remark;
                    model.MainRange         = txtMainRange.Text;
                    model.ZhuJi             = txtZhuJi.Text;
                    model.IsUse             = cbIsUse.Checked;
                    model.IsSpecial         = cbIsSpecial.Checked;
                    model.City              = ddlCity.Text;
                    model.Province          = ddlProvince.Text;
                    model.Peculiarity       = ddlPeculiarity.Text;
                    #endregion
                    if (Request["allE_id"] == null)//单据增加
                    {
                        VAN_OA.Model.EFrom.tb_EForm eform = new tb_EForm();

                        int userId = CreateUser;// Convert.ToInt32(DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)));
                        eform.appPer     = userId;
                        eform.appTime    = DateTime.Now;
                        eform.createPer  = Convert.ToInt32(Session["currentUserId"].ToString());
                        eform.createTime = DateTime.Now;
                        eform.proId      = Convert.ToInt32(Request["ProId"]);

                        if (ddlPers.Visible == false)
                        {
                            eform.state    = "通过";
                            eform.toPer    = 0;
                            eform.toProsId = 0;
                        }
                        else
                        {
                            eform.state    = "执行中";
                            eform.toPer    = Convert.ToInt32(ddlPers.SelectedItem.Value);
                            eform.toProsId = Convert.ToInt32(ViewState["ids"]);
                        }

                        TB_SupplierInfoService OverTimeSer = new TB_SupplierInfoService();
                        if (OverTimeSer.addTran(model, eform) > 0)
                        {
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('提交成功!');</script>");

                            if (Session["backurl"] != null)
                            {
                                base.Response.Redirect("~" + Session["backurl"]);
                            }
                            else
                            {
                                base.Response.Redirect("~/EFrom/MyRequestEForms.aspx");
                            }
                        }
                        else
                        {
                            btnSub.Enabled = false;
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('提交失败!');</script>");
                        }
                    }
                    else//审核
                    {
                        #region 本单据的ID
                        model.Id = Convert.ToInt32(Request["allE_id"]);
                        #endregion
                        tb_EForm  eform = new tb_EForm();
                        tb_EForms forms = new tb_EForms();


                        eform.id      = Convert.ToInt32(Request["EForm_Id"]);
                        eform.proId   = Convert.ToInt32(Request["ProId"]);
                        eform.allE_id = Convert.ToInt32(Request["allE_id"]);
                        int userId = CreateUser;// Convert.ToInt32(DBHelp.ExeScalar(string.Format("select ID from tb_User where loginName='{0}'", txtName.Text)));
                        eform.appPer = userId;



                        tb_EFormService fromSer = new tb_EFormService();
                        if (ViewState["ifConsignor"] != null && Convert.ToBoolean(ViewState["ifConsignor"]) == true)
                        {
                            forms.audPer    = fromSer.getCurrentAuPer(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]));
                            forms.consignor = Convert.ToInt32(Session["currentUserId"]);
                        }
                        else
                        {
                            forms.audPer    = Convert.ToInt32(Session["currentUserId"]);
                            forms.consignor = 0;
                        }
                        if (Request["ReAudit"] == null)
                        {
                            if (fromSer.ifAudiPerAndCon(Convert.ToInt32(Session["currentUserId"]), Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"])) == false)
                            {
                                if (Session["backurl"] != null)
                                {
                                    base.Response.Redirect("~" + Session["backurl"]);
                                }
                                else
                                {
                                    base.Response.Redirect("~/EFrom/MyRequestEForms.aspx");
                                }
                                return;
                            }
                        }

                        forms.doTime      = DateTime.Now;
                        forms.e_Id        = Convert.ToInt32(Request["EForm_Id"]); //fromSer.getCurrentid(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]));
                        forms.idea        = txtResultRemark.Text;
                        forms.prosIds     = fromSer.getCurrenttoProsId(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]));
                        forms.resultState = ddlResult.Text;
                        forms.RoleName    = fromSer.getCurrenttoRoleName(Convert.ToInt32(Request["ProId"]), Convert.ToInt32(Request["allE_id"]));
                        if (Request["ReAudit"] != null)
                        {
                            forms.RoleName = "重新编辑";
                        }
                        if (ddlPers.Visible == false)//说明为最后一次审核
                        {
                            eform.state    = ddlResult.Text;
                            eform.toPer    = 0;
                            eform.toProsId = 0;
                        }
                        else
                        {
                            if (ddlResult.Text == "不通过")
                            {
                                eform.state    = ddlResult.Text;
                                eform.toPer    = 0;
                                eform.toProsId = 0;
                            }
                            else
                            {
                                eform.state    = "执行中";
                                eform.toPer    = Convert.ToInt32(ddlPers.SelectedItem.Value);
                                eform.toProsId = Convert.ToInt32(ViewState["ids"]);


                                if (Request["ReAudit"] != null)//再次编辑
                                {
                                    VAN_OA.Model.ReportForms.TB_SupplierInfo oldModel = supplierSer.GetModel(Convert.ToInt32(Request["allE_id"]));
                                    var m   = JsonConvert.SerializeObject(oldModel);
                                    var sql = string.Format("insert INTO TB_SupplierInfo_History  ([SupplierInfoJosn],[SupplierId]) VALUES ('{0}',{1})", m, Request["allE_id"]);
                                    DBHelp.ExeCommand(sql);
                                }
                            }
                        }
                        if (ddlResult.Text == "不通过")
                        {
                            string sql   = string.Format("select top 1 SupplierInfoJosn from TB_SupplierInfo_History where SupplierId={0} order by id desc", Request["allE_id"]);
                            var    value = DBHelp.ExeScalar(sql);
                            if (value != null && !(value is DBNull))
                            {
                                model          = JsonConvert.DeserializeObject <TB_SupplierInfo>(value.ToString());
                                eform.state    = "通过";
                                eform.E_Remark = "驳回";
                            }
                        }
                        TB_SupplierInfoService OverTimeSer = new TB_SupplierInfoService();
                        if (OverTimeSer.updateTran(model, eform, forms))
                        {
                            // btnSub.Enabled = true;
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('提交成功!');</script>");
                            if (Session["backurl"] != null)
                            {
                                base.Response.Redirect("~" + Session["backurl"]);
                            }
                            else
                            {
                                base.Response.Redirect("~/EFrom/MyRequestEForms.aspx");
                            }
                        }
                        else
                        {
                            btnSub.Enabled = false;
                            base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('提交失败!');</script>");
                        }
                    }
                }
            }
        }
예제 #10
0
        public void Update(VAN_OA.Model.ReportForms.TB_SupplierInfo model, SqlCommand objCommand)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_SupplierInfo set ");
            if (model.Time != null)
            {
                strSql.Append("Time='" + model.Time + "',");
            }
            if (model.SupplierName != null)
            {
                strSql.Append("SupplierName='" + model.SupplierName + "',");
            }
            if (model.Phone != null)
            {
                strSql.Append("Phone='" + model.Phone + "',");
            }
            if (model.LikeMan != null)
            {
                strSql.Append("LikeMan='" + model.LikeMan + "',");
            }
            if (model.Job != null)
            {
                strSql.Append("Job='" + model.Job + "',");
            }
            if (model.FoxOrEmail != null)
            {
                strSql.Append("FoxOrEmail='" + model.FoxOrEmail + "',");
            }
            if (model.IfSave != null)
            {
                strSql.Append("IfSave=" + (model.IfSave ? 1 : 0) + ",");
            }
            else
            {
                strSql.Append("IfSave= null ,");
            }
            if (model.QQMsn != null)
            {
                strSql.Append("QQMsn='" + model.QQMsn + "',");
            }
            else
            {
                strSql.Append("QQMsn= null ,");
            }

            if (model.SupplierId != null)
            {
                strSql.Append("SupplierId='" + model.SupplierId + "',");
            }
            else
            {
                strSql.Append("SupplierId= null ,");
            }
            if (model.SupplierAddress != null)
            {
                strSql.Append("SupplierAddress='" + model.SupplierAddress + "',");
            }
            else
            {
                strSql.Append("SupplierAddress= null ,");
            }
            if (model.SupplierHttp != null)
            {
                strSql.Append("SupplierHttp='" + model.SupplierHttp + "',");
            }
            else
            {
                strSql.Append("SupplierHttp= null ,");
            }
            if (model.SupplierShui != null)
            {
                strSql.Append("SupplierShui='" + model.SupplierShui + "',");
            }
            else
            {
                strSql.Append("SupplierShui= null ,");
            }
            if (model.SupplierGong != null)
            {
                strSql.Append("SupplierGong='" + model.SupplierGong + "',");
            }
            else
            {
                strSql.Append("SupplierGong= null ,");
            }
            if (model.SupplierBrandNo != null)
            {
                strSql.Append("SupplierBrandNo='" + model.SupplierBrandNo + "',");
            }
            else
            {
                strSql.Append("SupplierBrandNo= null ,");
            }
            if (model.SupplierBrandName != null)
            {
                strSql.Append("SupplierBrandName='" + model.SupplierBrandName + "',");
            }
            else
            {
                strSql.Append("SupplierBrandName= null ,");
            }

            if (model.Remark != null)
            {
                strSql.Append("Remark='" + model.Remark + "',");
            }
            else
            {
                strSql.Append("Remark= null ,");
            }

            //if (model.SupplieSimpeName != null)
            //{
            //    strSql.Append("SupplieSimpeName='" + model.SupplieSimpeName + "',");
            //}

            if (model.MainRange != null)
            {
                strSql.Append("MainRange='" + model.MainRange + "',");
            }
            if (model.ZhuJi != null)
            {
                strSql.Append("ZhuJi='" + model.ZhuJi + "',");
            }
            strSql.Append("Status='" + model.Status + "',");
            if (model.IsUse != null)
            {
                strSql.Append("IsUse=" + (model.IsUse ? 1 : 0) + ",");
            }
            if (model.IsSpecial != null)
            {
                strSql.Append("IsSpecial=" + (model.IsSpecial ? 1 : 0) + ",");
            }
            strSql.Append("Province='" + model.Province + "',");
            strSql.Append("City='" + model.City + "',");
            strSql.Append("Peculiarity='" + model.Peculiarity + "',");
            int n = strSql.ToString().LastIndexOf(",");

            strSql.Remove(n, 1);
            strSql.Append(" where Id=" + model.Id + "");
            objCommand.CommandText = strSql.ToString();
            objCommand.ExecuteNonQuery();
        }
예제 #11
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(VAN_OA.Model.ReportForms.TB_SupplierInfo model)
        {
            StringBuilder strSql  = new StringBuilder();
            StringBuilder strSql1 = new StringBuilder();
            StringBuilder strSql2 = new StringBuilder();

            if (model.Time != null)
            {
                strSql1.Append("Time,");
                strSql2.Append("'" + model.Time + "',");
            }
            if (model.SupplierName != null)
            {
                strSql1.Append("SupplierName,");
                strSql2.Append("'" + model.SupplierName + "',");
            }
            if (model.Phone != null)
            {
                strSql1.Append("Phone,");
                strSql2.Append("'" + model.Phone + "',");
            }
            if (model.LikeMan != null)
            {
                strSql1.Append("LikeMan,");
                strSql2.Append("'" + model.LikeMan + "',");
            }
            if (model.Job != null)
            {
                strSql1.Append("Job,");
                strSql2.Append("'" + model.Job + "',");
            }
            if (model.FoxOrEmail != null)
            {
                strSql1.Append("FoxOrEmail,");
                strSql2.Append("'" + model.FoxOrEmail + "',");
            }
            if (model.IfSave != null)
            {
                strSql1.Append("IfSave,");
                strSql2.Append("" + (model.IfSave ? 1 : 0) + ",");
            }
            if (model.QQMsn != null)
            {
                strSql1.Append("QQMsn,");
                strSql2.Append("'" + model.QQMsn + "',");
            }
            if (model.FristMeet != null)
            {
                strSql1.Append("FristMeet,");
                strSql2.Append("'" + model.FristMeet + "',");
            }
            if (model.SecondMeet != null)
            {
                strSql1.Append("SecondMeet,");
                strSql2.Append("'" + model.SecondMeet + "',");
            }
            if (model.FaceMeet != null)
            {
                strSql1.Append("FaceMeet,");
                strSql2.Append("'" + model.FaceMeet + "',");
            }
            if (model.Price != null)
            {
                strSql1.Append("Price,");
                strSql2.Append("" + model.Price + ",");
            }
            if (model.IfSuccess != null)
            {
                strSql1.Append("IfSuccess,");
                strSql2.Append("" + (model.IfSuccess ? 1 : 0) + ",");
            }
            if (model.MyAppraise != null)
            {
                strSql1.Append("MyAppraise,");
                strSql2.Append("'" + model.MyAppraise + "',");
            }
            if (model.ManAppraise != null)
            {
                strSql1.Append("ManAppraise,");
                strSql2.Append("'" + model.ManAppraise + "',");
            }
            if (model.CreateUser != null)
            {
                strSql1.Append("CreateUser,");
                strSql2.Append("" + model.CreateUser + ",");
            }
            if (model.CreateTime != null)
            {
                strSql1.Append("CreateTime,");
                strSql2.Append("'" + model.CreateTime + "',");
            }


            if (model.SupplierAddress != null)
            {
                strSql1.Append("SupplierAddress,");
                strSql2.Append("'" + model.SupplierAddress + "',");
            }
            if (model.SupplierHttp != null)
            {
                strSql1.Append("SupplierHttp,");
                strSql2.Append("'" + model.SupplierHttp + "',");
            }
            if (model.SupplierShui != null)
            {
                strSql1.Append("SupplierShui,");
                strSql2.Append("'" + model.SupplierShui + "',");
            }
            if (model.SupplierGong != null)
            {
                strSql1.Append("SupplierGong,");
                strSql2.Append("'" + model.SupplierGong + "',");
            }
            if (model.SupplierBrandNo != null)
            {
                strSql1.Append("SupplierBrandNo,");
                strSql2.Append("'" + model.SupplierBrandNo + "',");
            }
            if (model.SupplierBrandName != null)
            {
                strSql1.Append("SupplierBrandName,");
                strSql2.Append("'" + model.SupplierBrandName + "',");
            }

            if (model.Remark != null)
            {
                strSql1.Append("Remark,");
                strSql2.Append("'" + model.Remark + "',");
            }


            if (model.SupplieSimpeName != null)
            {
                strSql1.Append("SupplieSimpeName,");
                strSql2.Append("'" + model.SupplieSimpeName + "',");
            }

            if (model.Status != null)
            {
                strSql1.Append("Status,");
                strSql2.Append("'" + model.Status + "',");
            }

            strSql1.Append("SupplierId,");
            strSql2.Append("'" + model.SupplierId + "',");

            strSql1.Append("ProNo,");

            if (model.MainRange != null)
            {
                strSql1.Append("MainRange,");
                strSql2.Append("'" + model.MainRange + "',");
            }
            if (model.ZhuJi != null)
            {
                strSql1.Append("ZhuJi,");
                strSql2.Append("'" + model.ZhuJi + "',");
            }
            if (model.IsSpecial != null)
            {
                strSql1.Append("IsSpecial,");
                strSql2.Append("" + (model.IsSpecial ? 1 : 0) + ",");
            }
            strSql1.Append("Province,");
            strSql2.Append("'" + model.Province + "',");

            strSql1.Append("City,");
            strSql2.Append("'" + model.City + "',");

            strSql1.Append("Peculiarity,");
            strSql2.Append("'" + model.Peculiarity + "',");
            //
            string MaxCardNo = "";
            string sql       = string.Format("select  right('0000000000'+(convert(varchar,(convert(int,right(max(ProNo),4))+1))),4) FROM TB_SupplierInfo;");

            object objMax = DBHelp.ExeScalar(sql);

            if (objMax != null && objMax.ToString() != "")
            {
                MaxCardNo = DateTime.Now.Year.ToString() + objMax.ToString();
            }
            else
            {
                MaxCardNo = DateTime.Now.Year.ToString() + "0001";
            }
            strSql2.Append("'" + MaxCardNo + "',");

            //
            strSql.Append("insert into TB_SupplierInfo(");
            strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1));
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1));
            strSql.Append(")");
            strSql.Append(";select @@IDENTITY");
            object obj = DBHelp.ExeScalar(strSql.ToString());

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #12
0
        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public VAN_OA.Model.ReportForms.TB_SupplierInfo ReaderBind(IDataReader dataReader)
        {
            VAN_OA.Model.ReportForms.TB_SupplierInfo model = new VAN_OA.Model.ReportForms.TB_SupplierInfo();
            object ojb;

            ojb = dataReader["Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Id = (int)ojb;
            }
            ojb = dataReader["Time"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Time = (DateTime)ojb;
            }
            model.SupplierName = dataReader["SupplierName"].ToString();
            model.Phone        = dataReader["Phone"].ToString();
            model.LikeMan      = dataReader["LikeMan"].ToString();
            model.Job          = dataReader["Job"].ToString();
            model.FoxOrEmail   = dataReader["FoxOrEmail"].ToString();
            ojb = dataReader["IfSave"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IfSave = (bool)ojb;
            }
            model.QQMsn      = dataReader["QQMsn"].ToString();
            model.FristMeet  = dataReader["FristMeet"].ToString();
            model.SecondMeet = dataReader["SecondMeet"].ToString();
            model.FaceMeet   = dataReader["FaceMeet"].ToString();
            ojb = dataReader["Price"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Price = (decimal)ojb;
            }
            ojb = dataReader["IfSuccess"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IfSuccess = (bool)ojb;
            }
            model.MyAppraise  = dataReader["MyAppraise"].ToString();
            model.ManAppraise = dataReader["ManAppraise"].ToString();
            ojb = dataReader["CreateUser"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateUser = (int)ojb;
            }
            ojb = dataReader["CreateTime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CreateTime = (DateTime)ojb;
            }

            ojb = dataReader["loginName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserName = ojb.ToString();
            }



            ojb = dataReader["SupplierId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierId = ojb.ToString();
            }


            ojb = dataReader["SupplierAddress"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierAddress = ojb.ToString();
            }

            ojb = dataReader["SupplierHttp"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierHttp = ojb.ToString();
            }

            ojb = dataReader["SupplierShui"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierShui = ojb.ToString();
            }

            ojb = dataReader["SupplierGong"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierGong = ojb.ToString();
            }
            ojb = dataReader["SupplierBrandNo"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierBrandNo = ojb.ToString();
            }

            ojb = dataReader["SupplierBrandNo"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierBrandNo = ojb.ToString();
            }
            ojb = dataReader["SupplierBrandName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplierBrandName = ojb.ToString();
            }

            ojb = dataReader["Remark"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Remark = ojb.ToString();
            }

            ojb = dataReader["ProNo"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ProNo = ojb.ToString();
            }

            ojb = dataReader["Status"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Status = ojb.ToString();
            }
            ojb = dataReader["SupplieSimpeName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SupplieSimpeName = ojb.ToString();
            }
            ojb = dataReader["MainRange"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.MainRange = ojb.ToString();
            }
            ojb = dataReader["ZhuJi"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.ZhuJi = ojb.ToString();
            }
            ojb = dataReader["IsUse"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsUse = (bool)ojb;
            }
            ojb = dataReader["IsSpecial"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsSpecial = (bool)ojb;
            }

            model.Province    = dataReader["Province"].ToString();
            model.City        = dataReader["City"].ToString();
            model.Peculiarity = dataReader["Peculiarity"].ToString();
            return(model);
        }