Exemplo n.º 1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (this.FormCheck())
            {
                try
                {
                    string   BusCardNo    = this.ddlCardNo.Text;
                    DateTime BusCardDate  = DateTime.Parse(this.txtBusCardDate.Text);
                    string   Address      = this.txtAddress.Text;
                    string   GuestName    = this.txtGuestName.Text;
                    decimal  UseTotal     = decimal.Parse(this.txtUseTotal.Text);
                    string   BusUseRemark = this.txtBusUseRemark.Text;

                    VAN_OA.Model.ReportForms.TB_BusCardUse model = new VAN_OA.Model.ReportForms.TB_BusCardUse();
                    model.BusCardNo    = BusCardNo;
                    model.BusCardPer   = "";
                    model.BusCardDate  = BusCardDate;
                    model.Address      = Address;
                    model.GuestName    = GuestName;
                    model.UseTotal     = UseTotal;
                    model.BusUseRemark = BusUseRemark;
                    model.POGuestName  = txtPOGuestName.Text;
                    model.POName       = txtPOName.Text;
                    model.PONo         = txtPONo.Text;

                    model.CreateUserId = Convert.ToInt32(Session["currentUserId"]);
                    if (this.busCardSer.Add(model) > 0)
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加成功!');</script>");
                        this.txtBusCardDate.Text  = "";
                        this.txtBusCardDate.Text  = "";
                        this.txtAddress.Text      = "";
                        this.txtGuestName.Text    = "";
                        this.txtUseTotal.Text     = "";
                        this.txtBusUseRemark.Text = "";
                        txtPONo.Text        = "";
                        txtPOName.Text      = "";
                        txtPOGuestName.Text = "";
                        this.ddlCardNo.Focus();
                    }
                    else
                    {
                        base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>");
                    }
                }
                catch (Exception ex)
                {
                    base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
                }
            }
        }
Exemplo n.º 2
0
 private void ShowInfo(int Id)
 {
     VAN_OA.Model.ReportForms.TB_BusCardUse model = busCardSer.GetModel(Id);
     ddlUser.Text              = model.UseName;
     this.ddlCardNo.Text       = model.BusCardNo;
     lblProNo.Text             = model.ProNo;
     this.txtBusCardDate.Text  = string.Format("{0:yyyy-MM-dd}", model.BusCardDate);
     this.txtAddress.Text      = model.Address;
     this.txtGuestName.Text    = model.GuestName;
     this.txtUseTotal.Text     = model.UseTotal.ToString();
     this.txtBusUseRemark.Text = model.BusUseRemark;
     txtPOGuestName.Text       = model.POGuestName;
     txtPOName.Text            = model.POName;
     txtPONo.Text              = model.PONo;
 }
Exemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FormCheck())
            {
                btnSub.Enabled = false;
                if (base.Request["ProId"] != null)
                {
                    #region 获取单据基本信息
                    string   BusCardNo    = this.ddlCardNo.Text;
                    DateTime BusCardDate  = DateTime.Parse(this.txtBusCardDate.Text);
                    string   Address      = this.txtAddress.Text;
                    string   GuestName    = this.txtGuestName.Text;
                    decimal  UseTotal     = decimal.Parse(this.txtUseTotal.Text);
                    string   BusUseRemark = this.txtBusUseRemark.Text;

                    VAN_OA.Model.ReportForms.TB_BusCardUse model = new VAN_OA.Model.ReportForms.TB_BusCardUse();
                    model.BusCardNo    = BusCardNo;
                    model.BusCardPer   = "";
                    model.BusCardDate  = BusCardDate;
                    model.Address      = Address;
                    model.GuestName    = GuestName;
                    model.UseTotal     = UseTotal;
                    model.BusUseRemark = BusUseRemark;
                    model.POGuestName  = txtPOGuestName.Text;
                    model.POName       = txtPOName.Text;
                    model.PONo         = txtPONo.Text;
                    model.CreateUserId = Convert.ToInt32(Session["currentUserId"]);
                    model.UseName      = ddlUser.Text;
                    #endregion
                    int CreateUser = Convert.ToInt32(Session["currentUserId"]);
                    if (Request["allE_id"] == null)//单据增加
                    {
                        VAN_OA.Model.EFrom.tb_EForm eform = new tb_EForm();
                        int userId = CreateUser;
                        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"]);
                        }
                        if (busCardSer.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 (busCardSer.updateTran(model, eform, forms))
                        {
                            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>");
                        }
                    }
                }
            }
        }