Beispiel #1
0
        /// <summary>
        /// 删除报价
        /// </summary>
        /// <param name="context"></param>
        /// <param name="quote_id"></param>

        public void DeleteQuote(HttpContext context, long quote_id)
        {
            if (AuthBLL.GetUserQuoteAuth(LoginUserId, LoginUser.security_Level_id, quote_id).CanDelete == false)
            {
                return;
            }

            var result = new QuoteBLL().DeleteQuote(quote_id, LoginUserId);
            if (result)
            {
                context.Response.Write("删除报价成功!");
            }
            else
            {
                context.Response.Write("删除报价失败!");
            }

        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                thisBookMark = new IndexBLL().GetSingBook(Request.RawUrl, LoginUserId);
                tmplList     = new FormTemplateBLL().GetTmplByType((int)DicEnum.FORM_TMPL_TYPE.QUOTE, LoginUserId);
                var id = Request.QueryString["id"];
                dic = new QuoteBLL().GetField();
                #region  拉框配置数据源
                tax_region_id.DataValueField = "val";
                tax_region_id.DataTextField  = "show";
                tax_region_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "taxRegion").Value;
                tax_region_id.DataBind();
                tax_region_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                payment_term_id.DataValueField = "val";
                payment_term_id.DataTextField  = "show";
                payment_term_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "payment_term").Value;
                payment_term_id.DataBind();
                payment_term_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });


                payment_type_id.DataValueField = "val";
                payment_type_id.DataTextField  = "show";
                payment_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "payment_type").Value;
                payment_type_id.DataBind();
                payment_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                shipping_type_id.DataValueField = "val";
                shipping_type_id.DataTextField  = "show";
                shipping_type_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "payment_ship_type").Value;
                shipping_type_id.DataBind();
                shipping_type_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });

                quote_tmpl_id.DataValueField = "id";
                quote_tmpl_id.DataTextField  = "name";
                quote_tmpl_id.DataSource     = dic.FirstOrDefault(_ => _.Key == "quote_tmpl").Value;
                quote_tmpl_id.DataBind();
                quote_tmpl_id.Items.Insert(0, new ListItem()
                {
                    Value = "0", Text = "   ", Selected = true
                });
                var prolist = new pro_project_dal().GetProjectList();
                // project_id
                //project_id.DataValueField = "id";
                //project_id.DataTextField = "name";
                //project_id.DataSource = prolist;
                //project_id.DataBind();
                //project_id.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
                #endregion

                if (!string.IsNullOrEmpty(id))
                {
                    if (AuthBLL.GetUserQuoteAuth(LoginUserId, LoginUser.security_Level_id, Convert.ToInt64(id)).CanEdit == false)
                    {
                        Response.End();
                        return;
                    }
                    quote = new crm_quote_dal().GetQuote(Convert.ToInt64(id));
                    if (quote != null)
                    {
                        if (string.IsNullOrEmpty(Request.QueryString["copy"]))
                        {
                            isAdd = false;
                        }
                    }
                }
                else
                {
                    var opportunity_id = Request.QueryString["quote_opportunity_id"];
                    if (!string.IsNullOrEmpty(opportunity_id))
                    {
                        opportunity = new crm_opportunity_dal().GetOpportunityById(long.Parse(opportunity_id));
                        account     = new CompanyBLL().GetCompany(opportunity.account_id);
                    }
                }
                if (!IsPostBack)
                {
                    if (!isAdd)
                    {
                        account = new CompanyBLL().GetCompany(quote.account_id);
                        if (account != null)
                        {
                            tax_region_id.SelectedValue = account.tax_region_id != null?account.tax_region_id.ToString() : "0";

                            payment_term_id.SelectedValue = quote.payment_term_id != null?quote.payment_term_id.ToString() : "0";

                            payment_type_id.SelectedValue = quote.payment_type_id != null?quote.payment_type_id.ToString() : "0";   //shipping_type_id

                            shipping_type_id.SelectedValue = quote.shipping_type_id != null?quote.shipping_type_id.ToString() : "0";

                            quote_tmpl_id.SelectedValue = quote.quote_tmpl_id != null?quote.quote_tmpl_id.ToString() : "0";

                            //project_id.SelectedValue = quote.project_id!=null ?  quote.project_id.ToString() : "0";
                            BillLocation.Checked = quote.bill_to_location_id == quote.sold_to_location_id;
                            ShipLocation.Checked = quote.ship_to_location_id == quote.sold_to_location_id;
                        }
                        #region 记录浏览历史
                        var history = new sys_windows_history()
                        {
                            title = $"编辑报价:" + quote.name + " " + (account != null ? account.name : ""),
                            url   = Request.RawUrl,
                        };
                        new IndexBLL().BrowseHistory(history, LoginUserId);
                        #endregion
                    }
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }