Example #1
0
        protected void AddQuoteTemplate(object sender, EventArgs e)
        {
            //this.DateFormat.
            sys_quote_tmpl sqt = new sys_quote_tmpl();

            sqt.name = this.Name.Text.Trim().ToString();
            if (this.Active.Checked)
            {
                sqt.is_active = 1;
            }
            else
            {
                sqt.is_active = 0;
            }
            sqt.description                 = this.Description.Text.Trim().ToString();
            sqt.paper_size_id               = paper_size_id();
            sqt.page_number_location_id     = page_number_location_id();
            sqt.create_user_id              = LoginUserId;
            sqt.currency_negative_format_id = Convert.ToInt32(this.CurrencyNegativePattern.SelectedValue.Trim().ToString());
            sqt.currency_positive_format_id = Convert.ToInt32(this.CurrencyPositivePattern.SelectedValue.Trim().ToString());
            sqt.number_display_format_id    = Convert.ToInt32(this.NumberFormat.SelectedValue.Trim().ToString());
            sqt.date_display_format_id      = Convert.ToInt32(this.DateFormat.SelectedValue.Trim().ToString());
            sqt.cate_id = 1;
            if (this.show_each_tax_in_tax_group.Checked)
            {
                sqt.show_each_tax_in_tax_group = 1;
            }
            else
            {
                sqt.show_each_tax_in_tax_group = 0;
            }
            if (this.show_each_tax_in_tax_period.Checked)
            {
                sqt.show_each_tax_in_tax_period = 1;
            }
            else
            {
                sqt.show_each_tax_in_tax_period = 0;
            }
            if (this.show_tax_cate.Checked)
            {
                sqt.show_tax_cate = 1;
            }
            else
            {
                sqt.show_tax_cate = 0;
            }
            if (this.show_tax_cate_superscript.Checked)
            {
                sqt.show_tax_cate_superscript = 1;
            }
            else
            {
                sqt.show_tax_cate_superscript = 0;
            }

            sqt.tax_total_disp = tax_total_disp();
            // sqt.create_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);

            QuoteTemplateBLL qtbll = new QuoteTemplateBLL();

            if (string.IsNullOrEmpty(sqt.name))
            {
                ClientScript.RegisterStartupScript(this.GetType(), "提示信息", "<script>alert('模板名称未填写!');</script>");
            }
            if (id > 0)
            {
                var result = qtbll.update(sqt, GetLoginUserId());
                if (result == ERROR_CODE.SUCCESS)
                {
                    Response.Write("<script>alert('报价模板属性修改成功');window.close();self.opener.location.reload();</script>");
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('报价模板属性修改成功');</script>");
                }
            }
            else
            {
                int id1;
                var result = qtbll.Add(sqt, GetLoginUserId(), out id1);
                if (result == ERROR_CODE.SUCCESS)                                                                        // 插入用户成功,刷新前一个页面
                {
                    Response.Write("<script>alert('报价模板添加成功!');window.close();self.opener.location.reload();</script>"); //  关闭添加页面的同时,刷新父页面
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)                                                             // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
            }
        }
Example #2
0
        protected void Save_Close_Click(object sender, EventArgs e)
        {
            sys_quote_tmpl data = new sys_quote_tmpl();

            if (id > 0)
            {
                data = temp.GetQuoteTemplate(id);
            }
            data.name = this.Name.Text.Trim().ToString();
            if (this.Active.Checked)
            {
                data.is_active = 1;
            }
            else
            {
                data.is_active = 0;
            }
            data.description                 = this.Description.Text.Trim().ToString();
            data.paper_size_id               = paper_size_id();
            data.page_number_location_id     = page_number_location_id();
            data.currency_negative_format_id = Convert.ToInt32(this.CurrencyNegativePattern.SelectedValue.Trim().ToString());
            data.currency_positive_format_id = Convert.ToInt32(this.CurrencyPositivePattern.SelectedValue.Trim().ToString());
            data.number_display_format_id    = Convert.ToInt32(this.NumberFormat.SelectedValue.Trim().ToString());
            data.date_display_format_id      = Convert.ToInt32(this.DateFormat.SelectedValue.Trim().ToString());
            data.payment_term_id             = Convert.ToInt32(this.Payment_terms.SelectedValue.Trim().ToString());
            data.show_each_tax_in_tax_group  = 1;
            data.show_tax_cate_superscript   = 1;
            data.show_tax_cate               = 1;
            data.show_each_tax_in_tax_period = 0;
            data.cate_id = 2;
            if (id > 0)
            {
                var result = temp.update(data, GetLoginUserId());
                if (result == ERROR_CODE.SUCCESS)
                {
                    Response.Write("<script>alert('发票模板属性修改成功');window.close();self.opener.location.reload();</script>");
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)               // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
                else
                {
                    Response.Write("<script>alert('发票模板属性修改失败!');</script>");
                }
            }
            else
            {
                var result = temp.Add(data, GetLoginUserId(), out id);
                if (result == ERROR_CODE.SUCCESS)                                                                        // 插入用户成功,刷新前一个页面
                {
                    Response.Write("<script>alert('发票模板添加成功!');window.close();self.opener.location.reload();</script>"); //  关闭添加页面的同时,刷新父页面
                }
                else if (result == ERROR_CODE.USER_NOT_FIND)                                                             // 用户丢失
                {
                    Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
                    Response.Redirect("Login.aspx");
                }
            }
        }