Esempio n. 1
0
        protected void grdBookingDetail_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grdBookingDetail = (ASPxGridView)sender;

            CriteriaOperator filter = new BinaryOperator("PurchaseInvoiceInventoryTransactionId", Guid.Parse(Session["InventoryTransactionId"].ToString()), BinaryOperatorType.Equal);
            XPCollection <PurchaseInvoiceInventoryAccountingTransaction> purchaseInvoiceTransaction = new XPCollection <PurchaseInvoiceInventoryAccountingTransaction>(session, filter);

            if (purchaseInvoiceTransaction.Count > 0)
            {
                foreach (PurchaseInvoiceInventoryAccountingTransaction item in purchaseInvoiceTransaction)
                {
                    if (item.RowStatus == ROW_NOT_DELETE)
                    {
                        grdBookingDetail.CancelEdit();
                        return;
                    }
                }
            }

            ASPxSpinEdit c = (ASPxSpinEdit)grdBookingDetail.FindEditRowCellTemplateControl((GridViewDataColumn)grdBookingDetail.Columns["Credit"], "colBookingDetailCredit");

            e.NewValues["Credit"] = c.Value.ToString();

            c = (ASPxSpinEdit)grdBookingDetail.FindEditRowCellTemplateControl((GridViewDataColumn)grdBookingDetail.Columns["Debit"], "colBookingDetailDebit");
            e.NewValues["Debit"] = c.Value.ToString();
        }
        protected void DMGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;

            ASPxTextBox qty   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittedQty"], "InvEdittedQty") as ASPxTextBox;
            ASPxTextBox cost  = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittedCost"], "InvEdittedCost") as ASPxTextBox;
            ASPxTextBox total = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EdittiedTotalCost"], "InvEdittiedTotalCost") as ASPxTextBox;

            string PK = e.Keys[0].ToString();
            Double qty_float = 0, cost_float = 0, total_float = 0;

            if (qty.Value != null)
            {
                qty_float = Convert.ToDouble(qty.Value.ToString());
            }
            if (cost.Value != null)
            {
                cost_float = Convert.ToDouble(cost.Value.ToString());
            }
            if (total.Value != null)
            {
                total_float = Convert.ToDouble(total.Value.ToString());
            }

            //Double qty_float = Convert.ToDouble(qty.Value.ToString());
            //Double cost_float = Convert.ToDouble(cost.Value.ToString());
            //Double total_float = Convert.ToDouble(total.Value.ToString());

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            //string update = "UPDATE " + MRPClass.DirectMatTable() +
            //                " SET [EdittedQty] = @QTY, [EdittedCost] = @COST, [EdittiedTotalCost] = @TOTAL, " +
            //                " [ApprovedQty] = @QTY, [ApprovedCost] = @COST, [ApprovedTotalCost] = @TOTAL " +
            //                " WHERE [PK] = @PK";
            //SqlCommand cmd = new SqlCommand(update, conn);
            //cmd.Parameters.AddWithValue("@PK", PK);
            //cmd.Parameters.AddWithValue("@QTY", qty_float);
            //cmd.Parameters.AddWithValue("@COST", cost_float);
            //cmd.Parameters.AddWithValue("@TOTAL", total_float);
            //cmd.CommandType = CommandType.Text;
            //int result = cmd.ExecuteNonQuery();

            int result = QuerySPClass.InsertUpdateDirectMaterials(wrkflwln, 2, Convert.ToInt32(PK), docnumber, 1, "", "", "", "", "", "", "", qty_float, cost_float, total_float);

            if (result > 0)
            {
                MRPClass.UpdateLastModified(conn, docnumber);
                string remarks = MRPClass.directmaterials_logs + "-" + MRPClass.edit_logs;
                MRPClass.AddLogsMOPList(conn, mrp_key, remarks);
            }

            conn.Close();

            e.Cancel = true;
            grid.CancelEdit();
            bindDM = true;
            BindDirectMaterials(docnumber);
        }
Esempio n. 3
0
        protected void grdBookingDetail_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView grdBookingDetail = (ASPxGridView)sender;

            CriteriaOperator filter = new BinaryOperator("SalesInvoiceId", Guid.Parse(Session["SaleBillId"].ToString()), BinaryOperatorType.Equal);
            XPCollection <SaleInvoiceTransaction> saleInvoiceTransaction = new XPCollection <SaleInvoiceTransaction>(session, filter);

            if (saleInvoiceTransaction.Count > 0)
            {
                foreach (SaleInvoiceTransaction item in saleInvoiceTransaction)
                {
                    if (item.RowStatus == ROW_NOT_DELETE)
                    {
                        grdBookingDetail.CancelEdit();
                        return;
                    }
                }
            }

            e.NewValues["TransactionId!Key"] = ((ASPxGridView)sender).GetMasterRowKeyValue();
            e.NewValues["GeneralJournalId"]  = Guid.NewGuid();



            ASPxSpinEdit c = (ASPxSpinEdit)grdBookingDetail.FindEditRowCellTemplateControl((GridViewDataColumn)grdBookingDetail.Columns["Credit"], "colBookingDetailCredit");

            e.NewValues["Credit"] = c.Value.ToString();

            c = (ASPxSpinEdit)grdBookingDetail.FindEditRowCellTemplateControl((GridViewDataColumn)grdBookingDetail.Columns["Debit"], "colBookingDetailDebit");
            e.NewValues["Debit"] = c.Value.ToString();
        }
Esempio n. 4
0
        public static void ValidateLength(string fieldname, int length, object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
        {
            ASPxGridView grid = (ASPxGridView)sender;

            if (fieldname == "ArrivalActual")
            {
                GridViewDataColumn col1           = grid.Columns["ArrivalActual"] as GridViewDataColumn;
                ASPxCheckBoxList   chkListArrival = grid.FindEditRowCellTemplateControl(col1, "ASPxCheckBoxListArrival") as ASPxCheckBoxList;
                if (chkListArrival.SelectedItem == null)
                {
                    e.RowError = "Fill all the fields";
                }
            }

            if (fieldname == "DepartureActual")
            {
                GridViewDataColumn col1             = grid.Columns["DepartureActual"] as GridViewDataColumn;
                ASPxCheckBoxList   chkListDeparture = grid.FindEditRowCellTemplateControl(col1, "ASPxCheckBoxListDeparture") as ASPxCheckBoxList;
                if (chkListDeparture.SelectedItem == null)
                {
                    e.RowError = "Fill all the fields";
                }
            }
            if (e.NewValues[fieldname] == null)
            {
                AddError(e.Errors, grid.Columns[fieldname],
                         fieldname + " cannot be null.");
            }
            if (e.NewValues[fieldname] != null &&
                e.NewValues[fieldname].ToString().Length < length)
            {
                AddError(e.Errors, grid.Columns[fieldname],
                         fieldname + " must be at least " + length + " characters long.");
            }
        }
Esempio n. 5
0
        protected void grdCreator_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView    grid         = sender as ASPxGridView;
            ASPxHiddenField masterKey    = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["MasterKey"], "ASPxCreatorMasterKeyHiddenField") as ASPxHiddenField;
            ASPxDateEdit    effectDate   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["EffectDate"], "CreatorEffectDate") as ASPxDateEdit;
            ASPxComboBox    sCreator     = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["UserCompleteName"], "Creator") as ASPxComboBox;
            ASPxComboBox    sCreatorStat = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["StatusDesc"], "CreatorStatus") as ASPxComboBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string sLastModified = DateTime.Now.ToString();

            string insert = "INSERT INTO tbl_System_BusinessUnit_Creator (MasterKey, UserKey, EffectDate, StatusKey) VALUES (@MasterKey, @UserKey, @EffectDate, @StatusKey)";

            SqlCommand cmd = new SqlCommand(insert, conn);

            cmd.Parameters.AddWithValue("@MasterKey", iBUSSUMasterKey.ToString());
            cmd.Parameters.AddWithValue("@UserKey", sCreator.Value.ToString());
            cmd.Parameters.AddWithValue("@EffectDate", effectDate.Value.ToString());
            cmd.Parameters.AddWithValue("@StatusKey", sCreatorStat.Value.ToString());
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            string updateMaster = "UPDATE tbl_System_BusinessUnit SET [LastModified] = @LastModified WHERE ([PK] = @PK)";

            SqlCommand cmd1 = new SqlCommand(updateMaster, conn);

            cmd1.Parameters.AddWithValue("@PK", iBUSSUMasterKey.ToString());
            cmd1.Parameters.AddWithValue("@LastModified", sLastModified.ToString());
            cmd1.CommandType = CommandType.Text;
            cmd1.ExecuteNonQuery();

            e.Cancel = true;
            grid.CancelEdit();
            //BindSCMProcOff_Details(Convert.ToInt32(sMasterKey.Value));
            //BindSCMProcOff_Details(iProcOffMaster);

            BindBUSSUListCreator(iBUSSUMasterKey);

            grdBUSSU.Enabled = true;

            int           pk_latest = 0;
            string        query_pk  = "SELECT TOP 1 [PK] FROM tbl_System_BusinessUnit_Creator ORDER BY [PK] DESC";
            SqlCommand    comm      = new SqlCommand(query_pk, conn);
            SqlDataReader r         = comm.ExecuteReader();

            while (r.Read())
            {
                pk_latest = Convert.ToInt32(r[0].ToString());
            }
            conn.Close();

            if (pk_latest > 0)
            {
                FocusThisRowGrid(grid, pk_latest);
            }
        }
        public static void SetTextBoxValue(this ASPxGridView grid, string columnName, string id, string value)
        {
            var box =
                grid.FindEditRowCellTemplateControl <ASPxTextBox>(columnName, id);


            grid.FindEditRowCellTemplateControl <ASPxTextBox>(columnName, id).Value = value;
        }
Esempio n. 7
0
        protected void ASPxGridView1_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
        {
            ASPxGridView grid               = (ASPxGridView)sender;
            ASPxSpinEdit unitPriceEditor    = (ASPxSpinEdit)grid.FindEditRowCellTemplateControl(((GridViewDataColumn)grid.Columns["UnitPrice"]), "UnitPriceEditor");
            ASPxSpinEdit unitsInStockEditor = (ASPxSpinEdit)grid.FindEditRowCellTemplateControl(((GridViewDataColumn)grid.Columns["UnitsInStock"]), "UnitsInStockEditor");
            ASPxTextBox  totalEditor        = (ASPxTextBox)grid.FindEditRowCellTemplateControl(((GridViewDataColumn)grid.Columns["Total"]), "TotalEditor");

            totalEditor.Value = Convert.ToDecimal(unitPriceEditor.Value) * Convert.ToDecimal(unitsInStockEditor.Value);
        }
Esempio n. 8
0
    protected void grid_DoDet_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        e.NewValues["Qty1"]          = SafeValue.SafeDecimal(e.NewValues["Qty1"]);
        e.NewValues["Price"]         = SafeValue.SafeDecimal(e.NewValues["Price"], 0);
        e.NewValues["QtyPackWhole"]  = SafeValue.SafeInt(e.NewValues["QtyPackWhole"], 0);
        e.NewValues["QtyWholeLoose"] = SafeValue.SafeInt(e.NewValues["QtyWholeLoose"], 0);
        e.NewValues["QtyLooseBase"]  = SafeValue.SafeInt(e.NewValues["QtyLooseBase"], 0);


        e.NewValues["LotNo"] = SafeValue.SafeString(e.NewValues["LotNo"]);
        e.NewValues["Uom1"]  = SafeValue.SafeString(e.NewValues["Uom1"]);
        e.NewValues["Uom2"]  = SafeValue.SafeString(e.NewValues["Uom2"]);
        e.NewValues["Uom3"]  = SafeValue.SafeString(e.NewValues["Uom3"]);
        e.NewValues["Uom4"]  = SafeValue.SafeString(e.NewValues["Uom4"]);
        ASPxGridView grid    = (sender as ASPxGridView) as ASPxGridView;
        ASPxComboBox cb_Att1 = grid.FindEditRowCellTemplateControl(null, "cb_Att1") as ASPxComboBox;
        ASPxComboBox cb_Att2 = grid.FindEditRowCellTemplateControl(null, "cb_Att2") as ASPxComboBox;
        ASPxComboBox cb_Att3 = grid.FindEditRowCellTemplateControl(null, "cb_Att3") as ASPxComboBox;

        e.NewValues["Att1"] = SafeValue.SafeString(cb_Att1.Text);
        e.NewValues["Att2"] = SafeValue.SafeString(cb_Att2.Text);
        e.NewValues["Att3"] = SafeValue.SafeString(cb_Att3.Text);
        ;
        //e.NewValues["Att7"] = SafeValue.SafeString(e.NewValues["Att7"]);
        //e.NewValues["Att8"] = SafeValue.SafeString(e.NewValues["Att8"]);
        //e.NewValues["Att9"] = SafeValue.SafeString(e.NewValues["Att9"]);
        //e.NewValues["Att10"] = SafeValue.SafeString(e.NewValues["Att10"]);

        e.NewValues["Des1"]     = SafeValue.SafeString(e.NewValues["Des1"]);
        e.NewValues["Currency"] = SafeValue.SafeString(e.NewValues["Currency"]);
        e.NewValues["ExRate"]   = SafeValue.SafeDecimal(e.NewValues["ExRate"], 0);
        e.NewValues["Gst"]      = SafeValue.SafeDecimal(e.NewValues["Gst"], 0);

        e.NewValues["ExpiredDate"] = SafeValue.SafeDate(e.NewValues["ExpiredDate"], DateTime.Today);
        string packing = "1" + SafeValue.SafeString(e.NewValues["Uom1"]);;

        if (SafeValue.SafeInt(e.NewValues["QtyPackWhole"], 0) > 0 && SafeValue.SafeString(e.NewValues["Uom2"]).Length > 0)
        {
            packing += string.Format("x{0}{1}", SafeValue.SafeInt(e.NewValues["QtyPackWhole"], 0), SafeValue.SafeString(e.NewValues["Uom2"]));
        }
        if (SafeValue.SafeInt(e.NewValues["QtyWholeLoose"], 0) > 0 && SafeValue.SafeString(e.NewValues["Uom3"]).Length > 0)
        {
            packing += string.Format("x{0}{1}", SafeValue.SafeInt(e.NewValues["QtyWholeLoose"], 0), SafeValue.SafeString(e.NewValues["Uom3"]));
        }
        if (SafeValue.SafeInt(e.NewValues["QtyLooseBase"], 0) > 0 && SafeValue.SafeString(e.NewValues["Uom4"]).Length > 0)
        {
            packing += string.Format("x{0}{1}", SafeValue.SafeInt(e.NewValues["QtyLooseBase"], 0), SafeValue.SafeString(e.NewValues["Uom4"]));
        }

        e.NewValues["Packing"] = packing;
        e.NewValues["DocAmt"]  = SafeValue.SafeDecimal(SafeValue.SafeInt(e.NewValues["Qty1"], 0) * SafeValue.SafeDecimal(e.NewValues["Price"], 0));
    }
        protected void POCreateGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid            = sender as ASPxGridView;
            ASPxComboBox POUOM           = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["POUOM"], "POUOM") as ASPxComboBox;
            ASPxTextBox  POQty           = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["POQty"], "POQty") as ASPxTextBox;
            ASPxTextBox  POCost          = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["POCost"], "POCost") as ASPxTextBox;
            ASPxTextBox  TotalPOCost     = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["TotalPOCost"], "TotalPOCost") as ASPxTextBox;
            ASPxTextBox  POCostwVAT      = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["POCostwVAT"], "POCostwVAT") as ASPxTextBox;
            ASPxTextBox  TotalPOCostwVAT = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["TotalPOCostwVAT"], "TotalPOCostwVAT") as ASPxTextBox;
            ASPxComboBox TaxGroup        = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["TaxGroup"], "TaxGroup") as ASPxComboBox;
            ASPxComboBox TaxItemGroup    = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["TaxItemGroup"], "TaxItemGroup") as ASPxComboBox;

            ASPxCheckBox wVAT = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["wVAT"], "CheckwVAT") as ASPxCheckBox;

            string PK   = e.Keys[0].ToString();
            int    iVAT = 0;

            if (Convert.ToBoolean(wVAT.Value))
            {
                iVAT = 1;
            }
            string update = "UPDATE dbo.tbl_POCreation_Tmp SET [TaxGroup] = @TaxGroup, [TaxItemGroup] = @TaxItemGroup,[POUOM] = @POUOM, [POQty] = @POQty, [POCost] = @POCost, [wVAT] = @wVAT, [POCostwVAT] = @POCostwVAT WHERE [PK] = @PK";

            string pouom    = POUOM.Value.ToString();
            string qty      = POQty.Value.ToString();
            string cost     = POCost.Value.ToString();
            string costwVAT = POCostwVAT.Value.ToString();
            //string total = TotalPOCost.Value.ToString();
            string tax_group      = TaxGroup.Text.ToString();
            string tax_item_group = TaxItemGroup.Text.ToString();

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();
            SqlCommand cmd = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@POQty", Convert.ToDouble(qty));
            cmd.Parameters.AddWithValue("@POUOM", pouom);
            cmd.Parameters.AddWithValue("@POCost", Convert.ToDouble(cost));
            //cmd.Parameters.AddWithValue("@POTotalCost", total);
            cmd.Parameters.AddWithValue("@TaxGroup", tax_group);
            cmd.Parameters.AddWithValue("@TaxItemGroup", tax_item_group);
            cmd.Parameters.AddWithValue("@wVAT", iVAT);
            cmd.Parameters.AddWithValue("@POCostwVAT", Convert.ToDouble(costwVAT));
            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            BindGrid(Session["CreatorKey"].ToString());

            grid.CancelEdit();
            e.Cancel = true;
        }
        protected void InfoGrid_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid   = sender as ASPxGridView;
            ASPxComboBox code   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Code"], "Code") as ASPxComboBox;
            ASPxTextBox  prefix = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Prefix"], "Prefix") as ASPxTextBox;
            ASPxTextBox  series = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["BeforeSeries"], "BeforeSeries") as ASPxTextBox;
            ASPxTextBox  max    = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["MaxNumber"], "MaxNumber") as ASPxTextBox;
            ASPxTextBox  last   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["LastNumber"], "LastNumber") as ASPxTextBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string PK     = e.Keys[0].ToString();
            string update = "UPDATE [dbo].[tbl_PONumber] SET [EntityCode] = @EntityCode, [Prefix] = @Prefix, [BeforeSeries] = @BeforeSeries, [MaxNumber] = @MaxNumber, [LastNumber] = @LastNumber WHERE [PK] = @PK";

            double max_number  = Convert.ToDouble(max.Text);
            double last_number = Convert.ToDouble(last.Text);

            string[] arr           = code.Text.ToString().Split(';');
            string   entity_string = arr[0];

            SqlCommand cmd = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@EntityCode", entity_string);
            cmd.Parameters.AddWithValue("@Prefix", prefix.Text);
            cmd.Parameters.AddWithValue("@BeforeSeries", series.Text);
            cmd.Parameters.AddWithValue("@MaxNumber", max_number);
            cmd.Parameters.AddWithValue("@LastNumber", last_number);
            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.CommandType = CommandType.Text;
            MRPClass.PrintString(code.Text);

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (SqlException exc)
            {
                MRPClass.PrintString(exc.Message);
            }


            conn.Close();
            grid.CancelEdit();
            e.Cancel = true;
            BindInfo();
        }
        protected void CAPEXCIP_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;
            //ASPxTextBox CIP = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["CIPSIPNumber"], "CIPSIPNumber") as ASPxTextBox;
            ASPxComboBox cipID    = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["CIPSIPNumber"], "FixedAssetID") as ASPxComboBox;
            string       PK       = e.Keys[0].ToString();
            string       cip_text = cipID.Value.ToString();

            if (!string.IsNullOrEmpty(cip_text))
            {
                //MRPClass.PrintString(cip_text + " " + PK );
                string update = "UPDATE [dbo].[tbl_MRP_List_CAPEX] SET [CIPSIPNumber] = '" + cip_text + "' WHERE [PK] = '" + PK + "'";
                //MRPClass.PrintString(update);

                SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());
                conn.Open();

                SqlCommand cmd    = new SqlCommand(update, conn);
                int        result = cmd.ExecuteNonQuery();


                //MRPClass.PrintString(result.ToString());
                conn.Close();
            }

            grid.CancelEdit();
            e.Cancel = true;
            BindCapex(month, year, entitycode, bucode);
        }
Esempio n. 12
0
    protected void Grid1_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView grid        = (sender as ASPxGridView) as ASPxGridView;
        ASPxComboBox txt_ChgCode = grid.FindEditRowCellTemplateControl(null, "txt_ChgCode") as ASPxComboBox;

        e.NewValues["JobNo"]   = "-1";
        e.NewValues["ChgCode"] = SafeValue.SafeString(txt_ChgCode.Value);
        string sql        = string.Format(@"select ChgcodeDes from XXChgCode where ChgcodeId='{0}'", SafeValue.SafeString(txt_ChgCode.Value));
        string chgcodeDes = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql));

        e.NewValues["LineStatus"]    = Helper.Safe.SafeString(e.NewValues["LineStatus"]).Trim();
        e.NewValues["Unit"]          = Helper.Safe.SafeString(e.NewValues["Unit"]).Trim();
        e.NewValues["ContSize"]      = Helper.Safe.SafeString(e.NewValues["ContSize"]).Trim();
        e.NewValues["ContType"]      = Helper.Safe.SafeString(e.NewValues["ContType"]).Trim();
        e.NewValues["Remark"]        = Helper.Safe.SafeString(e.NewValues["Remark"]).Trim();
        e.NewValues["BillScope"]     = Helper.Safe.SafeString(e.NewValues["BillScope"]).Trim();
        e.NewValues["BillType"]      = Helper.Safe.SafeString(e.NewValues["BillType"]).Trim();
        e.NewValues["BillClass"]     = Helper.Safe.SafeString(e.NewValues["BillClass"]).Trim();
        e.NewValues["RowCreateUser"] = HttpContext.Current.User.Identity.Name;
        e.NewValues["RowCreateTime"] = DateTime.Now;
        e.NewValues["RowUpdateUser"] = HttpContext.Current.User.Identity.Name;
        e.NewValues["RowUpdateTime"] = DateTime.Now;
        if (SafeValue.SafeString(e.NewValues["ChgCodeDe"]) == "")
        {
            e.NewValues["ChgCodeDe"] = chgcodeDes;
        }
        btn_search_Click(null, null);
    }
Esempio n. 13
0
        protected void ASPxGridView1_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid     = (ASPxGridView)sender;
            DataType     dataType = (DataType)grid.GetRowValuesByKeyValue(e.Keys[0], "Type");

            string editorID = string.Empty;

            switch (dataType)
            {
            case DataType.Text:
                editorID = "txt";
                break;

            case DataType.DateTime:
                editorID = "date";
                break;

            case DataType.Dictionary1:
                editorID = "dict";
                break;

            case DataType.Dictionary2:
                editorID = "dict";
                break;
            }

            ASPxEdit editor = (ASPxEdit)grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["DataValue"], editorID);

            e.NewValues["DataValue"] = editor.Value.ToString();
        }
Esempio n. 14
0
        protected void grdataBuyingToolCategory_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView grdToolOnCategory = sender as ASPxGridView;
            ASPxComboBox cboCode           = grdToolOnCategory.FindEditRowCellTemplateControl(this.grdataBuyingToolCategory.Columns["Code"] as GridViewDataColumn
                                                                                              , "cboCodeCategory") as ASPxComboBox;

            //List<ToolBuyingToolCategoryEntity> table = CategoryEntityList;
            //if (table == null)
            //    table = new List<ToolBuyingToolCategoryEntity>();
            //string selectedCode = cboCode.SelectedItem.Value.ToString();
            //ToolBuyingToolCategoryEntity category = new ToolBuyingToolCategoryEntity();
            //if (this.Action != "new")
            //{
            //    category = this.toolBOL.getCategoriesOnTool(selectedCode, this.toolKey);
            //}
            //else
            //{
            //    category = toolBOL.getCategoryByCode(selectedCode);
            //}

            //table.Add(new ToolBuyingToolCategoryEntity(
            //    category.ToolBuyingToolCategoryId,
            //    category.ToolId,
            //    category.BuyingToolCategoryId,
            //    selectedCode,
            //    category.Name
            //));

            //CategoryEntityList = table;
            //this.grdataBuyingToolCategory.DataSource = table;
            grdataBuyingToolCategory.DataBind();

            e.Cancel = true;
            grdataBuyingToolCategory.CancelEdit();
        }
Esempio n. 15
0
        protected void grdSCMProcurementOffDetails_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView    grid       = sender as ASPxGridView;
            ASPxHiddenField masterKey  = grdSCMProcurementOffDetails.FindEditRowCellTemplateControl((GridViewDataColumn)grdSCMProcurementOffDetails.Columns["MasterKey"], "ASPxMasterKeyHiddenField") as ASPxHiddenField;
            ASPxComboBox    scmProfCat = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ProcCatDesc"], "ProcurementCat") as ASPxComboBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string sLastModified = DateTime.Now.ToString();

            string insert = "INSERT INTO tbl_System_SCMProcurementOfficer_Details ([MasterKey], [ProcCat]) " +
                            " VALUES (@MasterKey, @ProcCat)";

            SqlCommand cmd = new SqlCommand(insert, conn);

            //cmd.Parameters.AddWithValue("@MasterKey", sMasterKey.Value.ToString());
            cmd.Parameters.AddWithValue("@MasterKey", iProcOffMaster.ToString());
            cmd.Parameters.AddWithValue("@ProcCat", scmProfCat.Value.ToString());
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            string updateMaster = "UPDATE tbl_System_SCMProcurementOfficer " +
                                  " SET [LastModified] = @LastModified " +
                                  " WHERE ([PK] = @PK)";

            SqlCommand cmd1 = new SqlCommand(updateMaster, conn);

            cmd1.Parameters.AddWithValue("@PK", iProcOffMaster.ToString());
            cmd1.Parameters.AddWithValue("@LastModified", sLastModified.ToString());
            cmd1.CommandType = CommandType.Text;
            cmd1.ExecuteNonQuery();

            e.Cancel = true;
            grid.CancelEdit();
            //BindSCMProcOff_Details(Convert.ToInt32(sMasterKey.Value));
            BindSCMProcOff_Details(iProcOffMaster);

            //grdSCMProcurementOff.Enabled = true;

            int           pk_latest = 0;
            string        query_pk  = "SELECT TOP 1 [PK] FROM tbl_System_SCMProcurementOfficer_Details ORDER BY [PK] DESC";
            SqlCommand    comm      = new SqlCommand(query_pk, conn);
            SqlDataReader r         = comm.ExecuteReader();

            while (r.Read())
            {
                pk_latest = Convert.ToInt32(r[0].ToString());
            }
            conn.Close();

            if (pk_latest > 0)
            {
                FocusThisRowGrid(grid, pk_latest);
            }
        }
        protected void dGridItemTarefa_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView Grid   = sender as ASPxGridView;
            PeopleEditor objppp = (PeopleEditor)Grid.FindEditRowCellTemplateControl((GridViewDataColumn)Grid.Columns[6], "pppAdd");

            if (objppp != null)
            {
                e.NewValues["Responsavel"] = objppp.CommaSeparatedAccounts;
            }
        }
    protected void gv_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView       gridView         = sender as ASPxGridView;
        GridViewDataColumn columnRftContent = gridView.Columns["RtfContent"] as GridViewDataColumn;
        ASPxHtmlEditor     htmlEditor       = gridView.FindEditRowCellTemplateControl(columnRftContent, "he") as ASPxHtmlEditor;

        e.NewValues["RtfContent"] = GetRtfTextFromASPxHtmlEditor(htmlEditor);

        throw new InvalidOperationException("Data modifications are not allowed in online demos");
        //Note that data modifications are not allowed in online demos. To allow editing in local/offline mode, download the example and comment out the "throw..." operation in the ASPxGridView.RowUpdating event handler.
    }
Esempio n. 18
0
        protected void CapexGridApproval_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid  = sender as ASPxGridView;
            ASPxTextBox  qty   = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedQty"], "ApprovedQtyCapex") as ASPxTextBox;
            ASPxTextBox  cost  = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedCost"], "ApprovedCostCapex") as ASPxTextBox;
            ASPxTextBox  total = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ApprovedTotalCost"], "ApprovedTotalCostCapex") as ASPxTextBox;

            string PK = e.Keys[0].ToString();

            Double qty_float   = Convert.ToDouble(qty.Value.ToString());
            Double cost_float  = Convert.ToDouble(cost.Value.ToString());
            Double total_float = Convert.ToDouble(total.Value.ToString());

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string     update = "UPDATE " + MRPClass.CapexTable() + " SET [ApprovedQty] = @QTY, [ApprovedCost] = @COST, [ApprovedTotalCost] = @TOTAL WHERE [PK] = @PK";
            SqlCommand cmd    = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.Parameters.AddWithValue("@QTY", qty_float);
            cmd.Parameters.AddWithValue("@COST", cost_float);
            cmd.Parameters.AddWithValue("@TOTAL", total_float);
            cmd.CommandType = CommandType.Text;
            int result = cmd.ExecuteNonQuery();

            if (result > 0)
            {
                MRPClass.UpdateLastModified(conn, docnumber);
                string remarks = MRPClass.capex_logs + "-" + MRPClass.edit_logs;
                MRPClass.AddLogsMOPList(conn, mrp_key, remarks);
            }

            conn.Close();

            e.Cancel = true;
            grid.CancelEdit();
            bindCapex = true;
            BindCapex(docnumber);
        }
        protected void InfoGrid_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView    grid       = sender as ASPxGridView;
            ASPxComboBox    code       = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Code"], "Code") as ASPxComboBox;
            ASPxHiddenField errorvalue = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Code"], "ErrorHiddenValue") as ASPxHiddenField;
            ASPxTextBox     prefix     = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Prefix"], "Prefix") as ASPxTextBox;
            ASPxTextBox     series     = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["BeforeSeries"], "BeforeSeries") as ASPxTextBox;
            ASPxTextBox     max        = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["MaxNumber"], "MaxNumber") as ASPxTextBox;
            ASPxTextBox     last       = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["LastNumber"], "LastNumber") as ASPxTextBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string insert = "INSERT INTO [dbo].[tbl_PONumber] ([EntityCode], [Prefix], [BeforeSeries], [MaxNumber], [LastNumber]) VALUES (@EntityCode, @Prefix, @BeforeSeries, @MaxNumber, @LastNumber)";

            double max_number  = Convert.ToDouble(max.Text);
            double last_number = Convert.ToDouble(last.Text);


            SqlCommand cmd = new SqlCommand(insert, conn);

            cmd.Parameters.AddWithValue("@EntityCode", code.Text);
            cmd.Parameters.AddWithValue("@Prefix", prefix.Text);
            cmd.Parameters.AddWithValue("@BeforeSeries", series.Text);
            cmd.Parameters.AddWithValue("@MaxNumber", max_number);
            cmd.Parameters.AddWithValue("@LastNumber", last_number);
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            conn.Close();
            grid.CancelEdit();
            e.Cancel = true;
            BindInfo();
        }
        protected void dGridItemTarefa_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView Grid      = sender as ASPxGridView;
            PeopleEditor objppp    = (PeopleEditor)Grid.FindEditRowCellTemplateControl((GridViewDataColumn)Grid.Columns[6], "pppAdd");
            int          ID_TAREFA = Convert.ToInt32((sender as ASPxGridView).GetMasterRowKeyValue());

            e.NewValues["ID_TAREFA"] = ID_TAREFA;

            if (objppp != null)
            {
                e.NewValues["Responsavel"] = objppp.CommaSeparatedAccounts;
            }
        }
Esempio n. 21
0
    protected void grid_Zone_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
    {
        ASPxGridView grid = (sender as ASPxGridView) as ASPxGridView;

        if (grid.EditingRowVisibleIndex > -1)
        {
            ASPxTextBox code = grid.FindEditRowCellTemplateControl(null, "txt_ZoneCode") as ASPxTextBox;
            if (code != null)
            {
                code.ReadOnly           = true;
                code.Border.BorderWidth = 0;
            }
        }
    }
Esempio n. 22
0
    protected void grid_det_HtmlEditFormCreated(object sender, ASPxGridViewEditFormEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;

        if (grid.EditingRowVisibleIndex > -1)
        {
            #region
            bool isDaily = SafeValue.SafeBool(grid.GetRowValues(grid.EditingRowVisibleIndex, new string[] { "IsDaily" }), false);
            if (isDaily)
            {
                ASPxSpinEdit dailyNo = grid.FindEditRowCellTemplateControl(null, "spin_det_DailyNo") as ASPxSpinEdit;
                dailyNo.ClientEnabled = false;
            }
            #endregion
        }
    }
    protected void ASPxGridView1_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e)
    {
        ASPxGridView gridView = ((ASPxGridView)sender);

        if (e.RowType == GridViewRowType.Data)
        {
            ASPxHyperLink hyperlink = ((ASPxHyperLink)gridView.FindRowCellTemplateControl(e.VisibleIndex, null, "btnEdit"));
            hyperlink.Visible     = true;
            hyperlink.NavigateUrl = string.Format("javascript:grid.StartEditRow('{0}');", e.VisibleIndex);
        }
        else
        if (e.RowType == GridViewRowType.InlineEdit)
        {
            GridViewDataColumn column    = (GridViewDataColumn)gridView.Columns["#"];
            ASPxHyperLink      hyperlink = (ASPxHyperLink)gridView.FindEditRowCellTemplateControl(column, "btnUpdate");
            hyperlink.ClientInstanceName = "btnUpdate_" + e.VisibleIndex.ToString();
        }
    }
        protected void ASPxGridViewNomina_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            ASPxGridView grid = (ASPxGridView)sender;
            ASPxComboBox cmb  = (ASPxComboBox)grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ClaveTrabajador"], "cmbEmployee");

            e.NewValues["ClaveTrabajador"] = cmb.Text;
            e.NewValues["ClaveConcepto"]   = ((ASPxGridView)sender).GetMasterRowKeyValue();

            //se obtiene la empresa del trabajador seleccionado
            EmployeeBusinessObject _EmployeeBAL  = new EmployeeBusinessObject();
            EmployeeEntityOnject   _EmployeeInfo = _EmployeeBAL.GetEmployee(e.NewValues["ClaveTrabajador"].ToString());

            PeriodoBusinessObject _PeriodoBAL  = new PeriodoBusinessObject();
            PeriodoEntityObject   _PeriodoInfo = _PeriodoBAL.GetPeriodoActualByNominaEmpresa(_EmployeeInfo.ClaveNomina, _EmployeeInfo.Empresa.Clave);

            e.NewValues["Empresa"] = _EmployeeInfo.Empresa.Clave;
            e.NewValues["Periodo"] = _PeriodoInfo.ClavePeriodo;
        }
    protected void gridViewData_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView     grid = sender as ASPxGridView;
        ASPxCheckBoxList cbl  = grid.FindEditRowCellTemplateControl(grid.Columns["EAN13"] as GridViewDataColumn, "cblSuppliers") as ASPxCheckBoxList;

        string ean13 = String.Empty;

        if (cbl.SelectedItems.Count > 0)
        {
            foreach (int supplierID in cbl.SelectedValues)
            {
                ean13 += supplierID.ToString() + ',';
            }
            ean13 = ean13.Trim(',');
        }
        e.NewValues["EAN13"] = ean13;

        e.Cancel = true; //COMMENT THIS LINE TO ALLOW UPDATING
    }
        protected void InfoGrid_RowValidating(object sender, DevExpress.Web.Data.ASPxDataValidationEventArgs e)
        {
            ASPxGridView grid = sender as ASPxGridView;
            ASPxComboBox code = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["Code"], "Code") as ASPxComboBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();
            SqlCommand    cmd    = null;
            SqlDataReader reader = null;

            string[] arr           = code.Text.ToString().Split(';');
            string   entity_string = arr[0];

            if (grid.IsNewRowEditing)
            {
                string check = "SELECT COUNT(*) FROM [dbo].[tbl_PONumber] WHERE [EntityCode] = '" + entity_string + "'";

                cmd = new SqlCommand(check, conn);
                Int32 result = Convert.ToInt32(cmd.ExecuteScalar());
                if (result > 0)
                {
                    e.RowError = "Entity Already Exist";
                }
            }
            else
            {
                string PK = e.Keys[0].ToString();

                string check = "SELECT [EntityCode] FROM [dbo].[tbl_PONumber] WHERE [EntityCode] = '" + entity_string + "' EXCEPT(SELECT[EntityCode] FROM[dbo].[tbl_PONumber] WHERE[PK] = '" + PK + "')";

                cmd    = new SqlCommand(check, conn);
                reader = cmd.ExecuteReader();
                bool result = reader.Read();
                if (result)
                {
                    e.RowError = "Entity Already Exist";
                }
            }
            conn.Close();
        }
        protected void gridDanhSach_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            string ID = e.Keys[0].ToString();


            ASPxGridView grid = sender as ASPxGridView;
            ASPxTimeEdit te   = grid.FindEditRowCellTemplateControl(grid.Columns["GioBatDau"] as GridViewDataColumn, "GioBatDau") as ASPxTimeEdit;
            object       obj  = e.NewValues["GioBatDau"].ToString();



            string GioBatDau  = DateTime.Parse(e.NewValues["GioBatDau"].ToString()).ToString("hh:mm tt");
            string GioKetThuc = DateTime.Parse(e.NewValues["GioKetThuc"].ToString()).ToString("hh:mm tt");
            string TyLe       = e.NewValues["TyLe"].ToString();

            data = new dtGio();
            data.Sua(ID, DateTime.Parse(GioBatDau), DateTime.Parse(GioKetThuc), TyLe);
            e.Cancel = true;
            gridDanhSach.CancelEdit();
            LoadGrid();
        }
Esempio n. 28
0
        protected void grdSCMProcurementOffDetails_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView    grid       = sender as ASPxGridView;
            ASPxHiddenField masterKey  = grdSCMProcurementOffDetails.FindEditRowCellTemplateControl((GridViewDataColumn)grdSCMProcurementOffDetails.Columns["MasterKey"], "ASPxMasterKeyHiddenField") as ASPxHiddenField;
            ASPxComboBox    scmProfCat = grid.FindEditRowCellTemplateControl((GridViewDataColumn)grid.Columns["ProcCatDesc"], "ProcurementCat") as ASPxComboBox;

            SqlConnection conn = new SqlConnection(GlobalClass.SQLConnString());

            conn.Open();

            string sLastModified = DateTime.Now.ToString();
            string PK            = e.Keys[0].ToString();

            string update = "UPDATE tbl_System_SCMProcurementOfficer_Details " +
                            " SET [ProcCat] = @ProcCat " +
                            " WHERE ([PK] = @PK)";

            SqlCommand cmd = new SqlCommand(update, conn);

            cmd.Parameters.AddWithValue("@PK", PK);
            cmd.Parameters.AddWithValue("@ProcCat", scmProfCat.Value.ToString());
            cmd.CommandType = CommandType.Text;
            cmd.ExecuteNonQuery();

            string updateMaster = "UPDATE tbl_System_SCMProcurementOfficer " +
                                  " SET [LastModified] = @LastModified " +
                                  " WHERE ([PK] = @PK)";

            SqlCommand cmd1 = new SqlCommand(updateMaster, conn);

            cmd1.Parameters.AddWithValue("@PK", iProcOffMaster.ToString());
            cmd1.Parameters.AddWithValue("@LastModified", sLastModified.ToString());
            cmd1.CommandType = CommandType.Text;
            cmd1.ExecuteNonQuery();

            conn.Close();
            e.Cancel = true;
            grid.CancelEdit();
            BindSCMProcOff_Details(iProcOffMaster);
        }
        private void UpdateMasterAccountActorComboBox(object sender)
        {
            ASPxCallbackPanel panel = sender as ASPxCallbackPanel;
            GridViewEditItemTemplateContainer itemContainer = (GridViewEditItemTemplateContainer)panel.NamingContainer;
            ASPxGridView grid = itemContainer.Grid;
            //Get allocation
            ASPxComboBox allocationComboBox =
                (ASPxComboBox)grid.FindEditRowCellTemplateControl(grid.Columns["Allocation!Key"] as GridViewDataColumn, "cboAllocation");

            if (allocationComboBox.Value == null)
            {
                return;
            }
            Guid       allocationId = (Guid)allocationComboBox.Value;
            Allocation allocation   = session.GetObjectByKey <Allocation>(allocationId);
            //Get account actor type
            AllocationAccountActorType masterAllocationAccountActorType =
                allocation.AllocationAccountActorTypes.FirstOrDefault(r => r.IsMaster);

            if (masterAllocationAccountActorType == null)
            {
                throw new Exception("Invalid allocation. Make sure that the allocation has a master account actor type.");
            }
            AccountActorType accountActorType = masterAllocationAccountActorType.AccountActorTypeId;

            AccountActorTypeEnum accountActorTypeEnum =
                (AccountActorTypeEnum)Enum.Parse(typeof(AccountActorTypeEnum), accountActorType.Code);
            //Get account actor combobox
            AccountActorComboBox accountActorComboBox =
                (AccountActorComboBox)panel.FindControl("accountActorComboBox"); //FindEditRowCellTemplateControl(grid.Columns["MasterAccountActor"] as GridViewDataColumn, "accountActorComboBox");

            //Validation setting
            accountActorComboBox.ComboBox.ValidationSettings.ErrorDisplayMode         = ErrorDisplayMode.ImageWithTooltip;
            accountActorComboBox.ComboBox.ValidationSettings.RequiredField.IsRequired = true;
            accountActorComboBox.ComboBox.ValidationSettings.RequiredField.ErrorText  =
                (string)HttpContext.GetGlobalResourceObject("MessageResource", "Msg_Required_Select");
            //Set account actor combobox strategy
            accountActorComboBox.SetAccountActorComboBoxStrategy(
                AccountActorComboBoxStrategyCreators.GetCreator(accountActorTypeEnum).Create());
        }
Esempio n. 30
0
    protected void Grid1_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
    {
        e.NewValues["Remark"]        = Helper.Safe.SafeString(e.NewValues["Remark"]).Trim();
        e.NewValues["RowUpdateUser"] = HttpContext.Current.User.Identity.Name;
        e.NewValues["RowUpdateTime"] = DateTime.Now;
        e.NewValues["LineStatus"]    = Helper.Safe.SafeString(e.NewValues["LineStatus"]).Trim();
        e.NewValues["Unit"]          = Helper.Safe.SafeString(e.NewValues["Unit"]).Trim();
        e.NewValues["ContType"]      = Helper.Safe.SafeString(e.NewValues["ContType"]).Trim();
        if (Helper.Safe.SafeString(e.NewValues["ContType"]).Trim() != "")
        {
            e.NewValues["ContSize"] = Helper.Safe.SafeString(e.NewValues["ContType"]).Trim().Substring(0, 2);
        }
        else
        {
            e.NewValues["ContSize"] = Helper.Safe.SafeString(e.NewValues["ContSize"]).Trim();
        }
        e.NewValues["Remark"]    = Helper.Safe.SafeString(e.NewValues["Remark"]).Trim();
        e.NewValues["BillScope"] = Helper.Safe.SafeString(e.NewValues["BillScope"]).Trim();
        e.NewValues["BillType"]  = Helper.Safe.SafeString(e.NewValues["BillType"]).Trim();
        e.NewValues["BillClass"] = Helper.Safe.SafeString(e.NewValues["BillClass"]).Trim();
        ASPxGridView   grid        = (sender as ASPxGridView) as ASPxGridView;
        ASPxButtonEdit txt_ChgCode = grid.FindEditRowCellTemplateControl(null, "txt_Line_ChgCode") as ASPxButtonEdit;
        string         sql         = string.Format(@"select ChgcodeDes from XXChgCode where ChgcodeId='{0}'", SafeValue.SafeString(txt_ChgCode.Value));
        string         chgcodeDes  = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql));

        if (SafeValue.SafeString(e.NewValues["ChgCodeDe"]) == "")
        {
            e.NewValues["ChgCodeDe"] = chgcodeDes;
        }
        e.NewValues["ChgCode"]     = SafeValue.SafeString(txt_ChgCode.Value);
        e.NewValues["ChgCodeDe"]   = SafeValue.SafeString(e.NewValues["ChgCodeDe"]);
        e.NewValues["SkuClass"]    = Helper.Safe.SafeString(e.NewValues["SkuClass"]).Trim();
        e.NewValues["SkuUnit"]     = Helper.Safe.SafeString(e.NewValues["SkuUnit"]).Trim();
        e.NewValues["JobType"]     = Helper.Safe.SafeString(e.NewValues["JobType"]).Trim();
        e.NewValues["StorageType"] = Helper.Safe.SafeString(e.NewValues["StorageType"]).Trim();
        e.NewValues["VehicleType"] = Helper.Safe.SafeString(e.NewValues["VehicleType"]).Trim();
        e.NewValues["GstType"]     = Helper.Safe.SafeString(e.NewValues["GstType"]).Trim();
        btn_search_Click(null, null);
    }