Beispiel #1
0
        /// <summary>
        ///     提交编辑
        /// </summary>
        private bool SubmintEdit()
        {
            if (ProductItem != null)
            {
                ProductItem.FName = txtFName.Text.Trim();

                //助记码
                ProductItem.FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "",
                                                                SpellOptions.FirstLetterOnly).ToUpper();

                ProductItem.FGroupNum      = txtFGroupNum.Text.Trim();
                ProductItem.FSpec          = txtFSpec.Text.Trim();
                ProductItem.FUnit          = ddlUnit.SelectedValue.Trim();
                ProductItem.FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim());
                ProductItem.FSalesPrice    = Convert.ToDecimal(txtFSalesPrice.Text.Trim());
                ProductItem.FMemo          = txtFMemo.Text.Trim();//备注
                ProductItem.FCompanyId     = CurrentUser.AccountComId;
                ProductItem.FGroupNum      = txtFGroupNum.Text.Trim();
                ProductItem.FIsLiquid      = ddlFIsLiquid.SelectedValue;
                ProductItem.FPieceWork1    = 0;//Convert.ToDecimal(txtFPieceWork.Text.Trim());
                ProductItem.FQty           = Convert.ToDecimal(txtFQty.Text.Trim());
                ProductItem.FPieceWork1    = Convert.ToDecimal(txtFPieceWork1.Text.Trim());
                ProductItem.FRack          = txtFRack.Text;
                ProductItem.cinvdefine1    = txtcinvdefine1.Text.Trim();


                //  包装物问题
                if (!ddlBottleNum.SelectedValue.Equals("-1"))
                {
                    var bottle = ItemsMapBottleService.Where(p => p.FCode == ProductItem.FCode && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();
                    if (bottle != null)
                    {
                        bottle.FBottleCode = ddlBottleNum.SelectedValue;
                        bottle.FCompanyId  = CurrentUser.AccountComId;
                        ItemsMapBottleService.SaveChanges();
                    }
                    else
                    {
                        var bot = new LHItemsMapBottle
                        {
                            FCode       = ProductItem.FCode,
                            FCompanyId  = CurrentUser.AccountComId,
                            FBottleCode = ddlBottleNum.SelectedValue
                        };

                        ItemsMapBottleService.Add(bot);
                    }
                }

                return(ItemsService.SaveChanges() >= 0);
            }
            return(false);
        }
Beispiel #2
0
        /// <summary>
        ///     提交添加
        /// </summary>
        private bool SubmintAdd()
        {
            var its = new LHItems
            {
                FCode  = txtFCode.Text.Trim(),
                FName  = txtFName.Text.Trim(),
                FSpec  = txtFSpec.Text.Trim(),
                FSpell = ChineseSpell.MakeSpellCode(txtFName.Text.Trim(), "",
                                                    SpellOptions.FirstLetterOnly).ToUpper(),
                FFlag = 1,

                //分类
                FCateId    = "2000",
                FSubCateId = ProjectItem.FId,

                FCompanyId = CurrentUser.AccountComId,
                FGroupNum  = txtFGroupNum.Text,
                FMemo      = txtFMemo.Text.Trim(),
                FIsLiquid  = ddlFIsLiquid.SelectedValue,
                FRack      = txtFRack.Text.Trim(),
                //单位
                FUnit          = ddlUnit.SelectedValue,
                FPurchasePrice = Convert.ToDecimal(txtFPurchasePrice.Text.Trim()),
                FSalesPrice    = Convert.ToDecimal(txtFSalesPrice.Text.Trim()),
                //FPieceWork1 = 0,//Convert.ToDecimal(txtFPieceWork.Text.Trim()),
                FQty        = Convert.ToDecimal(txtFQty.Text.Trim()),
                cinvdefine1 = txtcinvdefine1.Text,
                FPieceWork1 = Convert.ToDecimal(txtFPieceWork1.Text.Trim())
            };

            //  包装物问题
            if (!ddlBottleNum.SelectedValue.Equals("-1"))
            {
                var bottle = ItemsMapBottleService.Where(p => p.FCode == ProductItem.FCode && p.FCompanyId == CurrentUser.AccountComId).FirstOrDefault();
                if (bottle != null)
                {
                    bottle.FBottleCode = ddlBottleNum.SelectedValue;
                    ItemsMapBottleService.SaveChanges();
                }
                else
                {
                    var bot = new LHItemsMapBottle
                    {
                        FCode       = ProductItem.FCode,
                        FBottleCode = ddlBottleNum.SelectedValue
                    };

                    ItemsMapBottleService.Add(bot);
                }
            }

            return(ItemsService.Add(its));
        }
Beispiel #3
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            lblFName.Text = string.Format("{0}-{1}", ProjectItem.FId, ProjectItem.FName);
            switch (Actions)
            {
            case WebAction.Add:
                var parms = new Dictionary <string, object>();
                parms.Clear();

                parms.Add("@companyid", CurrentUser.AccountComId);
                parms.Add("@type", "2000");    //气体
                var list = SqlService.ExecuteProcedureCommand("proc_GetCode", parms).Tables[0];
                txtFCode.Text = list.Rows[0][0].ToString();
                break;

            case WebAction.Edit:

                txtFCode.Enabled  = false;
                txtFCode.Readonly = true;

                if (ProductItem != null)
                {
                    txtFCode.Text          = ProductItem.FCode;
                    txtFName.Text          = ProductItem.FName;
                    txtFGroupNum.Text      = ProductItem.FGroupNum;
                    txtFSpec.Text          = ProductItem.FSpec;
                    txtFPurchasePrice.Text = ProductItem.FPurchasePrice.ToString();
                    txtFSalesPrice.Text    = ProductItem.FSalesPrice.ToString();
                    txtFMemo.Text          = ProductItem.FMemo;
                    txtFPieceWork1.Text    = ProductItem.FPieceWork1.ToString();

                    ddlUnit.SelectedValue      = ProductItem.FUnit;
                    ddlFIsLiquid.SelectedValue = ProductItem.FIsLiquid;

                    txtFQty.Text        = ProductItem.FQty.ToString();
                    txtcinvdefine1.Text = ProductItem.cinvdefine1 == null?"": ProductItem.cinvdefine1.ToString();
                    //-------------------------------------------------------------
                    var bottle = ItemsMapBottleService.Where(p => p.FCode == ProductItem.FCode).FirstOrDefault();
                    if (bottle != null)
                    {
                        ddlBottleNum.SelectedValue = bottle.FBottleCode;
                    }
                    txtFRack.Text = ProductItem.FRack;
                    //-------------------------------------------------------------
                }
                break;
            }
        }
Beispiel #4
0
        protected void Grid1_RowClick(object sender, GridRowClickEventArgs e)
        {
            string ccode = Grid1.DataKeys[Grid1.SelectedRowIndexArray[0]][0].ToString();
            string cname = Grid1.DataKeys[Grid1.SelectedRowIndexArray[0]][1].ToString();

            var bottle = ItemsMapBottleService.Where(p => p.FCode == ccode).FirstOrDefault();

            if (bottle != null)
            {
                PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(ccode, cname, bottle.FBottleCode) +
                                                  ActiveWindow.GetHideReference());
            }
            else
            {
                PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(ccode, cname) +
                                                  ActiveWindow.GetHideReference());
            }
        }