Пример #1
0
        /// <summary>
        ///根据SQL语句获取实体
        /// </summary>
        public static To_Invoice getTo_InvoiceBySql(string sql)
        {
            To_Invoice to_invoice = null;
            DataTable  dt         = DBHelper.GetDataSet(sql);

            if (dt.Rows.Count > 0)
            {
                to_invoice = new To_Invoice();
                foreach (DataRow dr in dt.Rows)
                {
                    to_invoice.Id                 = Convert.ToInt32(dr["id"]);
                    to_invoice.InvoiceID          = Convert.ToString(dr["invoiceID"]);
                    to_invoice.InvoiceDate        = Convert.ToDateTime(dr["invoiceDate"]);
                    to_invoice.Selasmane          = Convert.ToInt32(dr["selasmane"]);
                    to_invoice.Sum                = Convert.ToDouble(dr["sum"]);
                    to_invoice.Department         = Convert.ToString(dr["department"]);
                    to_invoice.InvoiceUnit        = Convert.ToString(dr["invoiceUnit"]);
                    to_invoice.Remark             = Convert.ToString(dr["remark"]);
                    to_invoice.InvoiceCMan        = Convert.ToInt32(dr["invoiceCMan"]);
                    to_invoice.InvoiceCDepartment = Convert.ToInt32(dr["invoiceCDepartment"]);
                    to_invoice.InvoiceCDate       = Convert.ToDateTime(dr["invoiceCDate"]);
                    to_invoice.Upfile             = Convert.ToString(dr["upfile"]);
                    to_invoice.DetialID           = Convert.ToInt32(dr["detialID"]);
                    to_invoice.InvoiceType        = Convert.ToString(dr["invoiceType"]);
                    to_invoice.IsSure             = Convert.ToInt32(dr["IsSure"]);
                }
            }
            return(to_invoice);
        }
Пример #2
0
        //添加
        private void addinvoice()
        {
            LoginInfo  login   = (EtNet_Models.LoginInfo)Session["login"];
            To_Invoice invoice = new To_Invoice();

            //创建
            invoice.InvoiceCDate       = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            invoice.InvoiceCDepartment = DepartmentInfoManager.getDepartmentInfoById(login.Departid).Departid;
            invoice.InvoiceCMan        = login.Id;
            //发票
            invoice.InvoiceDate = DateTime.Parse(this.txtInvoiceDate.Value.ToString());
            invoice.InvoiceID   = this.txtInvoiceID.Value.ToString();
            invoice.InvoiceUnit = this.txtUnit.Value.ToString();
            invoice.Remark      = this.txtRemark.Text.ToString();
            invoice.Selasmane   = Convert.ToInt32(this.HidSalesman.Value.ToString());
            invoice.Department  = this.txtDepart.Value.ToString();
            invoice.Sum         = float.Parse(this.txtSum.Value);
            invoice.InvoiceType = this.ddlType.SelectedItem.Text.ToString();
            invoice.Upfile      = "";
            int count = To_InvoiceManager.addTo_Invoice(invoice);

            if (count > 0)
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('添加成功!');location.href='../Invoice/InvoiceList.aspx'", true);
                adddetial();
            }
        }
Пример #3
0
        protected void ibtnDeleteAll_Click(object sender, ImageClickEventArgs e)
        {
            string delId = "";

            //先遍历取得选中项

            for (int i = 0; i < this.rpInvoice.Items.Count; i++)
            {
                CheckBox cbx = (CheckBox)(rpInvoice.Items[i].FindControl("cbx"));
                Label    lbl = (Label)rpInvoice.Items[i].FindControl("lbl");
                if (cbx != null || cbx.Text != "")
                {
                    if (cbx.Checked)
                    {
                        delId += lbl.Text + ",";
                    }
                }
            }
            //去掉最后一个,
            delId = (delId + ")").Replace(",)", "");
            IList check = delId.Split(',');

            for (int i = 0; i < check.Count; i++)
            {
                To_Invoice to_Invoice = To_InvoiceManager.getTo_InvoiceById(Convert.ToInt32(check[i]));
                if (to_Invoice != null)
                {
                    To_InvoiceManager.deleteTo_Invoice(Convert.ToInt32(check[i]));
                }
            }
            dataBind();
        }
Пример #4
0
        private void binddata()
        {
            string     id      = Request.QueryString["id"].ToString();
            To_Invoice invoice = To_InvoiceManager.getTo_InvoiceById(Convert.ToInt32(id));

            this.lblInvoiceID.Text     = invoice.InvoiceID.ToString();
            this.lblInvoiceDate.Text   = invoice.InvoiceDate.ToString("yyyy-MM-dd");
            this.lblInvoiceDepart.Text = invoice.Department.ToString();
            this.lblInvoiceRemark.Text = invoice.Remark.ToString();
            this.lblInvoiceUnit.Text   = invoice.InvoiceUnit.ToString();
            this.lblSalesman.Text      = LoginInfoManager.getLoginInfoById(invoice.Selasmane).Cname.ToString();
            this.lblCost.Text          = invoice.Sum.ToString() + ".00";
            this.lblCDate.Text         = invoice.InvoiceCDate.ToString("yyyy-MM-dd");
            this.lblCDepart.Text       = DepartmentInfoManager.getDepartmentInfoById(invoice.InvoiceCDepartment).Departcname.ToString();
            this.lblCMan.Text          = LoginInfoManager.getLoginInfoById(invoice.InvoiceCMan).Cname.ToString();
            this.lblInvoiceType.Text   = invoice.InvoiceType.ToString();
            lblState.Text = invoice.IsSure == 1 ? "已确认" : "<font color='red'>未确认</font>";
            rpBind(invoice.Id.ToString());
        }
Пример #5
0
        private void addinvoice()
        {
            int id    = Convert.ToInt32(this.txtInvoiceID.Value.ToString());
            int idsum = To_InvoiceManager.getInvoiceById(id);


            if (idsum == 0)
            {
                LoginInfo  login   = (EtNet_Models.LoginInfo)Session["login"];
                To_Invoice invoice = new To_Invoice();
                //创建
                invoice.InvoiceCDate       = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
                invoice.InvoiceCDepartment = DepartmentInfoManager.getDepartmentInfoById(login.Departid).Departid;
                invoice.InvoiceCMan        = login.Id;
                //发票
                invoice.InvoiceDate = DateTime.Parse(this.txtInvoiceDate.Value.ToString());
                invoice.InvoiceID   = this.txtInvoiceID.Value.ToString();
                invoice.InvoiceID   = this.txtInvoiceID.Value.ToString();
                invoice.InvoiceUnit = this.txtUnit.Value.ToString();
                invoice.Remark      = this.txtRemark.Value.ToString();
                invoice.Selasmane   = Convert.ToInt32(this.HidSalesman.Value.ToString());
                invoice.Department  = this.txtDepart.Value.ToString();
                invoice.Sum         = float.Parse(this.txtSum.Value);
                invoice.InvoiceType = this.ddlType.SelectedItem.Text.ToString();
                invoice.Upfile      = "";
                invoice.IsSure      = this.ChkConfirm.Checked ? 1 : 0;

                int count = To_InvoiceManager.addTo_Invoice(invoice);

                if (count > 0)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('添加成功!');location.href='../Invoice/InvoiceList.aspx'", true);

                    addcombank();
                }
            }
            else
            {
                lblInvoiceID.Text         = "<font color='red'>发票号码已存在!</font>";
                this.policyList.InnerHtml = this.hidTable.Value;
            }
        }
Пример #6
0
        private void bindPage()
        {
            string     id      = Request.QueryString["id"].ToString();
            To_Invoice invoice = To_InvoiceManager.getTo_InvoiceById(Convert.ToInt32(id));

            this.lblCDate.Value       = invoice.InvoiceCDate.ToString("yyyy-MM-dd");
            this.lblCDepart.Value     = DepartmentInfoManager.getDepartmentInfoById(invoice.InvoiceCDepartment).Departcname.ToString();
            this.lblCMan.Value        = LoginInfoManager.getLoginInfoById(invoice.InvoiceCMan).Cname.ToString();
            this.txtInvoiceID.Value   = invoice.InvoiceID.ToString();
            this.txtDepart.Value      = invoice.Department.ToString();
            this.txtInvoiceDate.Value = invoice.InvoiceDate.ToString("yyyy-MM-dd");
            this.txtRemark.Value      = invoice.Remark.ToString();
            this.TxtSalesman.Value    = LoginInfoManager.getLoginInfoById(invoice.Selasmane).Cname.ToString();
            this.HidSalesman.Value    = invoice.Selasmane.ToString();
            this.txtSum.Value         = invoice.Sum.ToString();
            this.txtUnit.Value        = invoice.InvoiceUnit.ToString();
            this.ddlType.Items.FindByText(invoice.InvoiceType).Selected = true;
            this.ChkConfirm.Checked = invoice.IsSure == 1;
            //rpBind(invoice.Id.ToString());
            rpBind(id.ToString());
        }
Пример #7
0
        /// <summary>
        ///[to_Invoice]表添加的方法
        /// </summary>
        public static int addTo_Invoice(To_Invoice to_invoice)
        {
            string sql = "insert into to_Invoice([invoiceID],[invoiceDate],[selasmane],[sum],[department],[invoiceUnit],[remark],[invoiceCMan],[invoiceCDepartment],[invoiceCDate],[upfile],[detialID],[invoiceType],[IsSure]) values (@invoiceID,@invoiceDate,@selasmane,@sum,@department,@invoiceUnit,@remark,@invoiceCMan,@invoiceCDepartment,@invoiceCDate,@upfile,@detialID,@invoiceType,@IsSure)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@invoiceID", to_invoice.InvoiceID),
                new SqlParameter("@invoiceDate", to_invoice.InvoiceDate),
                new SqlParameter("@selasmane", to_invoice.Selasmane),
                new SqlParameter("@sum", to_invoice.Sum),
                new SqlParameter("@department", to_invoice.Department),
                new SqlParameter("@invoiceUnit", to_invoice.InvoiceUnit),
                new SqlParameter("@remark", to_invoice.Remark),
                new SqlParameter("@invoiceCMan", to_invoice.InvoiceCMan),
                new SqlParameter("@invoiceCDepartment", to_invoice.InvoiceCDepartment),
                new SqlParameter("@invoiceCDate", to_invoice.InvoiceCDate),
                new SqlParameter("@upfile", to_invoice.Upfile),
                new SqlParameter("@detialID", to_invoice.DetialID),
                new SqlParameter("@invoiceType", to_invoice.InvoiceType),
                new SqlParameter("@IsSure", to_invoice.IsSure)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Пример #8
0
        /// <summary>
        ///[to_Invoice]表查询实体的方法
        /// </summary>
        public static To_Invoice getTo_InvoiceById(int id)
        {
            To_Invoice to_invoice = null;

            string sql = "select * from to_Invoice where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", id)
            };
            DataTable dt = DBHelper.GetDataSet(sql, sp);

            if (dt.Rows.Count > 0)
            {
                to_invoice = new To_Invoice();
                foreach (DataRow dr in dt.Rows)
                {
                    to_invoice.Id                 = Convert.ToInt32(dr["id"]);
                    to_invoice.InvoiceID          = Convert.ToString(dr["invoiceID"]);
                    to_invoice.InvoiceDate        = Convert.ToDateTime(dr["invoiceDate"]);
                    to_invoice.Selasmane          = Convert.ToInt32(dr["selasmane"]);
                    to_invoice.Sum                = Convert.ToDouble(dr["sum"]);
                    to_invoice.Department         = Convert.ToString(dr["department"]);
                    to_invoice.InvoiceUnit        = Convert.ToString(dr["invoiceUnit"]);
                    to_invoice.Remark             = Convert.ToString(dr["remark"]);
                    to_invoice.InvoiceCMan        = Convert.ToInt32(dr["invoiceCMan"]);
                    to_invoice.InvoiceCDepartment = Convert.ToInt32(dr["invoiceCDepartment"]);
                    to_invoice.InvoiceCDate       = Convert.ToDateTime(dr["invoiceCDate"]);
                    to_invoice.Upfile             = Convert.ToString(dr["upfile"]);
                    to_invoice.DetialID           = Convert.ToInt32(dr["detialID"]);
                    to_invoice.InvoiceType        = Convert.ToString(dr["invoiceType"]);
                    to_invoice.IsSure             = Convert.ToInt32(dr["IsSure"]);
                }
            }

            return(to_invoice);
        }
Пример #9
0
        private void bindPage()
        {
            LoginInfo login = (EtNet_Models.LoginInfo)Session["login"];

            //this.txtInvoiceID.Value = "FP" + DateTime.Now.ToString("yyyyMMddHHmmss");
            this.txtInvoiceDate.Value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string     id      = Request.QueryString["id"].ToString();
            To_Invoice invoice = To_InvoiceManager.getTo_InvoiceById(Convert.ToInt32(id));

            this.lblCDate.Text   = invoice.InvoiceCDate.ToString();
            this.lblCDepart.Text = DepartmentInfoManager.getDepartmentInfoById(invoice.InvoiceCDepartment).Departcname.ToString();
            this.lblCMan.Text    = LoginInfoManager.getLoginInfoById(invoice.InvoiceCMan).Cname.ToString();

            this.txtDepart.Value = invoice.Department.ToString();

            this.txtRemark.Text        = invoice.Remark.ToString();
            this.TxtSalesman.Value     = LoginInfoManager.getLoginInfoById(invoice.Selasmane).Cname.ToString();
            this.HidSalesman.Value     = invoice.Selasmane.ToString();
            this.txtSum.Value          = invoice.Sum.ToString();
            this.txtUnit.Value         = invoice.InvoiceUnit.ToString();
            this.ddlType.SelectedValue = invoice.InvoiceType.ToString();
            //rpBind(invoice.Id.ToString());
            rpBind(id.ToString());
        }
Пример #10
0
        /// <summary>
        ///[to_Invoice]表修改的方法
        /// </summary>
        public static int updateTo_InvoiceById(To_Invoice to_invoice)
        {
            string sql = "update to_Invoice set invoiceID=@invoiceID,invoiceDate=@invoiceDate,selasmane=@selasmane,sum=@sum,department=@department,invoiceUnit=@invoiceUnit,remark=@remark,invoiceCMan=@invoiceCMan,invoiceCDepartment=@invoiceCDepartment,invoiceCDate=@invoiceCDate,upfile=@upfile,detialID=@detialID,invoiceType=@invoiceType,IsSure=@IsSure where id=@id";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("@id", to_invoice.Id),
                new SqlParameter("@invoiceID", to_invoice.InvoiceID),
                new SqlParameter("@invoiceDate", to_invoice.InvoiceDate),
                new SqlParameter("@selasmane", to_invoice.Selasmane),
                new SqlParameter("@sum", to_invoice.Sum),
                new SqlParameter("@department", to_invoice.Department),
                new SqlParameter("@invoiceUnit", to_invoice.InvoiceUnit),
                new SqlParameter("@remark", to_invoice.Remark),
                new SqlParameter("@invoiceCMan", to_invoice.InvoiceCMan),
                new SqlParameter("@invoiceCDepartment", to_invoice.InvoiceCDepartment),
                new SqlParameter("@invoiceCDate", to_invoice.InvoiceCDate),
                new SqlParameter("@upfile", to_invoice.Upfile),
                new SqlParameter("@detialID", to_invoice.DetialID),
                new SqlParameter("@invoiceType", to_invoice.InvoiceType),
                new SqlParameter("@IsSure", to_invoice.IsSure)
            };
            return(DBHelper.ExecuteCommand(sql, sp));
        }
Пример #11
0
 public static int updateTo_Invoice(To_Invoice to_invoice)
 {
     return(To_InvoiceService.updateTo_InvoiceById(to_invoice));
 }
Пример #12
0
 public static int addTo_Invoice(To_Invoice to_invoice)
 {
     return(To_InvoiceService.addTo_Invoice(to_invoice));
 }