コード例 #1
0
ファイル: AddPurchaseOrder.aspx.cs プロジェクト: evelh/Done
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["act"] == "edit")
            {
                isAdd = false;
            }
            else
            {
                isAdd = true;
            }

            if (!isAdd)
            {
                orderId = long.Parse(Request.QueryString["id"]);
            }

            if (!IsPostBack)
            {
                Session["PurchaseOrderItem"] = new PurchaseOrderItemManageDto();
                var generalBll = new GeneralBLL();
                paymentTerms = generalBll.GetDicValues(GeneralTableEnum.PAYMENT_TERM);
                taxRegion    = generalBll.GetDicValues(GeneralTableEnum.TAX_REGION);
                shipCate     = generalBll.GetDicValues(GeneralTableEnum.PAYMENT_SHIP_TYPE);
                itemDescType = generalBll.GetDicValues(GeneralTableEnum.ITEM_DESC_DISPLAY_TYPE);
                if (!isAdd)
                {
                    orderEdit = bll.GetPurchaseOrder(orderId);
                }

                // 库存产品列表中创建采购订单
                if (isAdd && (!string.IsNullOrEmpty(Request.QueryString["ids"])))
                {
                    Session["PurchaseOrderItem"] = new InventoryProductBLL().InitPurchaseOrderItems(Request.QueryString["ids"], out defaultVendorAccountId);
                }
            }
            else
            {
                var action = Request.Form["subAct"];
                if (action == "Cancle")
                {
                    Session.Remove("PurchaseOrderItem");
                    Response.Write("<script>window.close();</script>");
                    Response.End();
                    return;
                }

                var order    = AssembleModel <ivt_order>();
                var location = AssembleModel <crm_location>();
                var items    = Session["PurchaseOrderItem"] as PurchaseOrderItemManageDto;

                if (!string.IsNullOrEmpty(Request.Form["checkShowTaxCate"]) && Request.Form["checkShowTaxCate"].Equals("on"))
                {
                    order.display_tax_cate = 1;
                }
                if (!string.IsNullOrEmpty(Request.Form["checkTaxSeparate"]) && Request.Form["checkTaxSeparate"].Equals("on"))
                {
                    order.display_tax_seperate_line = 1;
                }

                var shipType = Request.Form["shipAddr"];
                if (shipType == "0")
                {
                    order.ship_to_type_id     = (int)DicEnum.INVENTORY_ORDER_SHIP_ADDRESS_TYPE.WORK_ADDRESS;
                    order.purchase_account_id = thisCompanyId;
                }
                else if (shipType == "1")
                {
                    order.ship_to_type_id = (int)DicEnum.INVENTORY_ORDER_SHIP_ADDRESS_TYPE.OTHER_ADDRESS;
                }
                else if (shipType == "2")
                {
                    order.ship_to_type_id = (int)DicEnum.INVENTORY_ORDER_SHIP_ADDRESS_TYPE.SELECTED_COMPANY;
                }
                else
                {
                    Response.End();
                    return;
                }

                if (action == "SaveClose" || action == "SaveSubmit" || action == "SaveNew" || action == "SubmitEmail")
                {
                    if (action == "SaveSubmit" || action == "SubmitEmail")
                    {
                        // TODO: 提交验证

                        order.status_id             = (int)DicEnum.PURCHASE_ORDER_STATUS.SUBMITTED;
                        order.submitted_resource_id = LoginUserId;
                        order.submit_time           = EMT.Tools.Date.DateHelper.ToUniversalTimeStamp();
                    }
                    else
                    {
                        if (isAdd)
                        {
                            order.status_id = (int)DicEnum.PURCHASE_ORDER_STATUS.NEW;
                        }
                    }
                    if (!isAdd)
                    {
                        order.id = orderId;
                        bll.EditOrder(order, location, LoginUserId);
                    }
                    else
                    {
                        bll.AddOrder(order, items.items, location, LoginUserId);
                    }
                    if (action == "SaveClose")
                    {
                        Response.Write("<script>window.close();self.opener.location.reload();</script>");
                        Response.End();
                    }
                    if (action == "SaveNew")
                    {
                        Response.Write("<script>window.location.href='AddPurchaseOrder.aspx?act=add';self.opener.location.reload();</script>");
                        Response.End();
                    }
                    if (action == "SaveSubmit" || action == "SubmitEmail")
                    {
                        Response.Write("<script>window.close();self.opener.location.reload();</script>");
                        Response.End();
                    }
                }
            }
        }
コード例 #2
0
ファイル: SysUserEdit.aspx.cs プロジェクト: evelh/Done
        private void Bind()
        {
            var dic = new UserResourceBLL().GetDownList();

            // 日期格式
            this.DateFormat.DataTextField  = "show";
            this.DateFormat.DataValueField = "val";
            this.DateFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value;
            this.DateFormat.DataBind();
            // DateFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //数字格式
            this.NumberFormat.DataTextField  = "show";
            this.NumberFormat.DataValueField = "val";
            this.NumberFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value;
            NumberFormat.DataBind();
            // NumberFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //TimeFormat时间格式
            this.TimeFormat.DataTextField  = "show";
            this.TimeFormat.DataValueField = "val";
            this.TimeFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "TimeFormat").Value;
            TimeFormat.DataBind();
            // TimeFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //EmailType50
            this.EmailType.DataTextField  = "show";
            this.EmailType.DataValueField = "val";
            this.EmailType.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType.DataBind();
            EmailType.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            this.EmailType1.DataTextField  = "show";
            this.EmailType1.DataValueField = "val";
            this.EmailType1.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType1.DataBind();
            EmailType1.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            this.EmailType2.DataTextField  = "show";
            this.EmailType2.DataValueField = "val";
            this.EmailType2.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType2.DataBind();
            EmailType2.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //Sex49
            this.Sex.DataTextField  = "show";
            this.Sex.DataValueField = "val";
            this.Sex.DataSource     = dic.FirstOrDefault(_ => _.Key == "Sex").Value;
            Sex.DataBind();
            Sex.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //NameSuffix
            this.NameSuffix.DataTextField  = "show";
            this.NameSuffix.DataValueField = "val";
            this.NameSuffix.DataSource     = dic.FirstOrDefault(_ => _.Key == "NameSuffix").Value;
            NameSuffix.DataBind();
            NameSuffix.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //Prefix前缀
            //Prefix.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //Prefix.Items.Insert(1, new ListItem() { Value = "1", Text = "Mr." });
            //Prefix.Items.Insert(2, new ListItem() { Value = "2", Text = "Mrs." });
            //Prefix.Items.Insert(3, new ListItem() { Value = "3", Text = "Ms." });
            //主要位置  location_id

            this.Position.DataTextField  = "name";
            this.Position.DataValueField = "id";
            this.Position.DataSource     = dic.FirstOrDefault(_ => _.Key == "Position").Value;
            Position.DataBind();
            Position.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            Position.Items.Insert(1, new ListItem()
            {
                Value = "1", Text = "总部"
            });
            //授权tab页

            //权限等级
            //this.Security_Level
            this.Security_Level.DataTextField  = "name";
            this.Security_Level.DataValueField = "id";
            this.Security_Level.DataSource     = dic.FirstOrDefault(_ => _.Key == "Security_Level").Value;
            Security_Level.DataBind();
            Security_Level.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //外包权限
            //this.Outsource_Security
            this.Outsource_Security.DataTextField  = "show";
            this.Outsource_Security.DataValueField = "val";
            this.Outsource_Security.DataSource     = dic.FirstOrDefault(_ => _.Key == "Outsource_Security").Value;
            Outsource_Security.DataBind();
            Outsource_Security.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });

            //员工类型
            var genBll  = new GeneralBLL();
            var resType = genBll.GetDicValues(GeneralTableEnum.RESOURCE_TYPE);

            type_id.DataTextField  = "show";
            type_id.DataValueField = "val";
            type_id.DataSource     = resType;
            type_id.DataBind();

            //薪资类型
            var payType = genBll.GetDicValues(GeneralTableEnum.PAYROLL_TYPE);

            payroll_type_id.DataTextField  = "show";
            payroll_type_id.DataValueField = "val";
            payroll_type_id.DataSource     = payType;
            payroll_type_id.DataBind();

            hire_date.Text             = DateTime.Now.ToString("yyyy-MM-dd");
            time_sheet_start_date.Text = DateTime.Now.ToString("yyyy-MM-dd");

            var tmoffBll = new TimeOffPolicyBLL();
            // 休假方案
            var policyList = tmoffBll.GetPolicyList();

            timeoff_policy_id.DataTextField  = "name";
            timeoff_policy_id.DataValueField = "id";
            timeoff_policy_id.DataSource     = policyList;
            timeoff_policy_id.DataBind();
            timeoff_policy_id.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "", Selected = true
            });

            // 出差限度
            var travelRest = genBll.GetDicValues(GeneralTableEnum.TRAVEL_RESTRICTIONS);

            travel_restrictions_id.DataTextField  = "show";
            travel_restrictions_id.DataValueField = "val";
            travel_restrictions_id.DataSource     = travelRest;
            travel_restrictions_id.DataBind();
        }