Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Grid1_AfterEdit(object sender, GridAfterEditEventArgs e)
        {
            var addList = Grid1.GetNewAddedList();

            foreach (var add in addList)
            {
                var dictValues = add.Values;

                //商品代码
                var firstOrDefault = dictValues.First();

                if (firstOrDefault != null && !string.IsNullOrEmpty(firstOrDefault.ToString()))
                {
                    DataSet dataSet = GasHelper.GetSalesItem(firstOrDefault.ToString(), CurrentUser.AccountComId);

                    DataTable table = dataSet.Tables[0];

                    if (table != null && table.Rows.Count > 0)
                    {
                        decimal price = GasHelper.GeCustomerPrice(txtFCode.Text,//
                                                                  table.Rows[0]["FItemCode"].ToString(), CurrentUser.AccountComId);

                        table.Rows[0]["FPrice"] = price;

                        var details = new LHLeaseDetails
                        {
                            FBottle    = table.Rows[0]["FItemCode"].ToString(),
                            FPrice     = price,
                            FBottleQty = 1,
                            FAmount    = price,
                            //单日租金
                            FRentDay   = 1,
                            FCompanyId = CurrentUser.AccountComId,
                            KeyId      = txtKeyId.Text.Trim(),
                            FCateId    = Convert.ToInt32(table.Rows[0]["FId"].ToString())
                        };

                        switch (Actions)
                        {
                        case WebAction.Add:
                            break;

                        case WebAction.Edit:
                            //记录一下当前新增人操作内容
                            var detailslog = new LHLeaseDetails_Log
                            {
                                FUpdateBy   = CurrentUser.AccountName,
                                FUpdateDate = DateTime.Now,
                                FBottle     = table.Rows[0]["FItemCode"].ToString(),
                                FPrice      = price,
                                FBottleQty  = 1,
                                FAmount     = price,
                                KeyId       = txtKeyId.Text.Trim(),
                                FRentDay    = 1,
                                FCompanyId  = CurrentUser.AccountComId,
                                FStatus     = "新增",
                                //FMemo = string.Format(@"时间:{0} 新增人:{1}", DateTime.Now, CurrentUser.AccountName)
                            };

                            //detailslog.FCompanyId = CurrentUser.AccountComId;
                            //detailslog.FCateId = Convert.ToInt32(table.Rows[0]["FId"].ToString());

                            LeaseDetailsLogService.Add(detailslog);

                            break;
                        }

                        LeaseDetailsService.Add(details);
                    }
                }
            }



            if (addList.Count > 0)
            {
                BindDataGrid();
            }
        }