protected void grdvOnusRegistro_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = grdvOnusRegistro.EditingRowVisibleIndex;

            string[] x = new string[15];

            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ABO_MIKROT  = Convert.ToString(e.NewValues["U_DXP_ABO_MIKROT"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_CODABO  = Convert.ToString(e.NewValues["U_DXP_ONU_CODABO"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_TARJETA = Convert.ToString(e.NewValues["U_DXP_ONU_TARJETA"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_PUERTO  = Convert.ToString(e.NewValues["U_DXP_ONU_PUERTO"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_ABONADO = Convert.ToString(e.NewValues["U_DXP_ONU_ABONADO"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_COD_ONU     = Convert.ToString(e.NewValues["U_DXP_COD_ONU"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_TYPE    = Convert.ToString(e.NewValues["U_DXP_ONU_TYPE"]);
            ((List <BEOnu>)Session["DXP_REGISTRO_ONU"])[index].U_DXP_ONU_ESTADO  = Convert.ToString(e.NewValues["U_DXP_ONU_ESTADO"]);


            //var obrd = new BRDocument();
            //obrd.CRUD_PENDIENTES(obep);
            //var olst = obrd.DXP_GET_ISP_REGISTROTMP(obep);

            grdvOnusRegistro.CancelEdit();
            e.Cancel = true;
            grdvOnusRegistro.DataSource = Session["DXP_REGISTRO_ONU"];
            grdvOnusRegistro.DataBind();
        }
Beispiel #2
0
    protected void gvEmployees_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gridView = sender as ASPxGridView;

        //Comment a line below to allow updating
        e.Cancel = true; gridView.CancelEdit();
    }
Beispiel #3
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.FindEditFormTemplateControl(editorID);

            e.NewValues["DataValue"] = editor.Value.ToString();
        }
Beispiel #4
0
    protected void gv_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = sender as ASPxGridView;

        gv.CancelEdit();
        e.Cancel = true;
    }
        protected void gvData_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var newValues = e.NewValues;
            var oldValues = e.OldValues;

            var tableModel = Model.Table;

            foreach (var column in tableModel.Columns)
            {
                var name  = String.Format("v{0}", column.Name.ComputeCrc16());
                var value = Convert.ToString(newValues[column.Name]);

                sqlDs.UpdateParameters.Add(name, value);
            }

            var primaryColumns = tableModel.Columns.Where(n => n.IsPrimary).ToList();

            if (primaryColumns.Count == 0)
            {
                primaryColumns = tableModel.Columns;
            }

            foreach (var column in primaryColumns)
            {
                var name  = String.Format("w{0}", column.Name.ComputeCrc16());
                var value = Convert.ToString(oldValues[column.Name]);

                sqlDs.UpdateParameters.Add(name, value);
            }
        }
        protected void gdvFacturas_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec        = ((BEParameters)Session["InitPar"]);
            var index       = gdvFacturas.EditingRowVisibleIndex;
            var moneda      = "";
            var band        = true;
            var total       = 0.0;
            var controlador = "";

            ((List <BEDocument>)Session["tecn"])[index].PagoTotal = Convert.ToDecimal(e.NewValues["PagoTotal"]);
            ((List <BEDocument>)Session["tecn"])[index].Descto    = Convert.ToString(e.NewValues["Descto"]);
            ((List <BEDocument>)Session["tecn"])[index].Active    = Convert.ToString(e.NewValues["Active"]);

            ((List <BEDocument>)Session["tecn"]).Where(i => i.Active == "Y").ToList().ForEach(x => {
                if (band)
                {
                    moneda = x.DocCur;
                    band   = false;
                }
                if (x.DocCur == moneda)
                {
                    total += Convert.ToDouble(x.PagoTotal);
                }
                else
                {
                    controlador = "XXXX";
                }
            });

            ((List <BEDocument>)Session["tecn"]).ForEach(i =>
            {
                if (i.DocCur == "SOL")
                {
                    i.DocTotal = i.PagoTotal;
                }
                else if (i.DocCur == "USD")
                {
                    i.DocTotal = i.PagoTotal * obec.Rate;
                }
                else if (i.DocCur == "EUR")
                {
                    i.DocTotal = i.PagoTotal * obec.RateEur;
                }
            });

            gdvFacturas.JSProperties["cpSubTotal"] = ((List <BEDocument>)Session["tecn"]).Where(i => i.Active == "Y").ToList().Sum(item => Math.Round(item.DocTotal, 2));
            if (controlador == "")
            {
                gdvFacturas.JSProperties["cpTotalito"] = total;
            }
            else
            {
                gdvFacturas.JSProperties["cpTotalito"] = controlador;
            }

            gdvFacturas.CancelEdit();
            e.Cancel = true;
            gdvFacturas.DataSource = ((List <BEDocument>)Session["tecn"]);
            gdvFacturas.DataBind();
        }
Beispiel #7
0
    protected void gridDocs_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        var x = e;

        bool results_docVers = DxDbOps.BuildUpdateSqlCode(e, "tblDocVers", "backend");


        OrderedDictionary oldvals = e.OldValues;
        OrderedDictionary newvals = e.NewValues;
        OrderedDictionary keys    = new OrderedDictionary();

        keys.Add("DocID", oldvals["DocID"]);

        bool results_doc = DxDbOps.BuildUpdateSqlCode(keys, newvals, oldvals, "tblDoc", "backend");


        int measureID = Convert.ToInt32(Request.QueryString["mID"]);

        LoadDocs(measureID);

        e.Cancel = true;
        gridDocs.CancelEdit();

        //		gridDocs.EndUpdate();
    }
Beispiel #8
0
 protected void ASPxGridView2_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     if (!ValidarConexionYUsuarioLogueado(sender))
     {
         return;
     }
     try
     {
         var formLayout = ASPxGridView2.FindEditFormTemplateControl("ASPxFormLayout1") as ASPxFormLayout;
         if (formLayout != null)
         {
             var gridLookupVendedor = formLayout.FindControl("GridLookupVendedor") as ASPxGridLookup;
             var memoComentarios    = formLayout.FindControl("MemoComentarios") as ASPxMemo;
             var timeEditHoraVisita = formLayout.FindControl("TimeEditHoraVisita") as ASPxTimeEdit;
             var spinPrioridad      = formLayout.FindControl("SpinPrioridad") as ASPxSpinEdit;
             var customerCode       = ASPxGridView2.GetRowValuesByKeyValue(e.Keys[0], "CUSTOMER_CODE");
             var customerName       = ASPxGridView2.GetRowValuesByKeyValue(e.Keys[0], "CUSTOMER_NAME");
             var pResult            = "";
             _objTask.UpdateInsertPresaleTasks(Session["connectionString"].ToString(),
                                               customerCode.ToString(), customerName.ToString(),
                                               gridLookupVendedor.Text, memoComentarios.Text, timeEditHoraVisita.DateTime,
                                               ASPxCalendar1.SelectedDate, Convert.ToInt32(spinPrioridad.Number), ref pResult);
         }
         GetTasksByDate(ASPxCalendar1.SelectedDate);
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true);
     }
     ASPxGridView2.CancelEdit();
     e.Cancel = true;
 }
Beispiel #9
0
        protected void gdvCuentas_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = gdvCuentas.EditingRowVisibleIndex;

            ((List <BECuentasPago>)Session["rct4"])[index].AcctCode  = Convert.ToString(e.NewValues["AcctCode"]);
            ((List <BECuentasPago>)Session["rct4"])[index].AcctName  = Convert.ToString(e.NewValues["AcctName"]);
            ((List <BECuentasPago>)Session["rct4"])[index].CurrTotal = Convert.ToString(e.NewValues["CurrTotal"]);

            //gdvFacturas.JSProperties["cpSubTotal"] = ((List<BEDocument>)Session["tecn"]).Where(i => i.Active == "Y").ToList().Sum(item => Math.Round(item.PagoTotal, 2));

            Set_LineNum();
            ((List <BECuentasPago>)Session["rct4"]).ForEach(i =>
            {
                if (i.ActCurr == "SOL")
                {
                    i.Total = Convert.ToDecimal(i.CurrTotal);
                }
                else if (i.ActCurr == "USD")
                {
                    i.Total = Convert.ToDecimal(i.CurrTotal) * obec.Rate;
                }
                else if (i.ActCurr == "EUR")
                {
                    i.Total = Convert.ToDecimal(i.CurrTotal) * obec.RateEur;
                }
            });

            gdvCuentas.JSProperties["cpSubTotalPlanCuenta"] = ((List <BECuentasPago>)Session["rct4"]).Sum(item => Math.Round(item.Total, 2));

            gdvCuentas.CancelEdit();
            e.Cancel = true;
            gdvCuentas.DataSource = ((List <BECuentasPago>)Session["rct4"]);
            gdvCuentas.DataBind();
        }
Beispiel #10
0
 protected void StudentCardsGrid_OnRowUpdating(object Sender, ASPxDataUpdatingEventArgs E)
 {
     if (2 != E.NewValues["StatusCode"] as int?)
     {
         E.NewValues["ExpirationDate"] = null;
     }
 }
        protected void gdvTipoCambio_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = gdvTipoCambio.EditingRowVisibleIndex;

            //if(((List<BEAlmacen>)Session["oitw"])[index].Tiempo == "Existente")

            ((List <BETipoCambio>)Session["ortt"])[index].RateUSD = Convert.ToDecimal(e.NewValues["RateUSD"]);
            ((List <BETipoCambio>)Session["ortt"])[index].RateEUR = Convert.ToDecimal(e.NewValues["RateEUR"]);

            BETipoCambio tp = new BETipoCambio();

            tp.RateDate = Convert.ToDateTime(e.NewValues["RateDate"]);
            tp.RateUSD  = Convert.ToDecimal(e.NewValues["RateUSD"]);
            tp.RateEUR  = Convert.ToDecimal(e.NewValues["RateEUR"]);

            gdvTipoCambio.CancelEdit();
            e.Cancel = true;
            gdvTipoCambio.DataSource = ((List <BETipoCambio>)Session["ortt"]);
            gdvTipoCambio.DataBind();

            using (var obrd = new BRDocument())
            {
                obrd.SaveCurrencyDates(tp, ((BEParameters)Session["InitPar"]).objSapSbo);
                ((BEParameters)Session["InitPar"]).Rate    = tp.RateUSD;
                ((BEParameters)Session["InitPar"]).RateEur = tp.RateEUR;
                //Rate1 = tp.RateUSD;
            }
        }
Beispiel #12
0
    protected void Grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        Person person = FindPersonById((int)e.Keys[0]);

        person.Name = e.NewValues["Name"].ToString();

        CheckBoxList list = (CheckBoxList)Grid.FindEditRowCellTemplateControl((GridViewDataColumn)Grid.Columns[2], "List");

        if (Grid.IsCallback)
        {
            LoadListControlPostDataOnCallback(list);
        }

        person.Categories.Clear();
        foreach (ListItem item in list.Items)
        {
            if (item.Selected)
            {
                person.Categories.Add(FindCategoryByName(item.Value));
            }
        }

        e.Cancel = true;
        Grid.CancelEdit();
    }
Beispiel #13
0
 protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     //ASPxPageControl pageControl = grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
     //ASPxMemo memo = pageControl.FindControl("notesEditor") as ASPxMemo;
     //e.NewValues["Notes"] = memo.Text;
     //e.Cancel = true;
 }
Beispiel #14
0
 protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     //ASPxPageControl pageControl = grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
     //ASPxMemo memo = pageControl.FindControl("notesEditor") as ASPxMemo;
     //e.NewValues["Notes"] = memo.Text;
     //e.Cancel = true;
 }
        protected void gdvAsiento_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            gdvAsiento.DoRowValidation();
            var index = gdvAsiento.EditingRowVisibleIndex;

            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Credit = Convert.ToDecimal(e.NewValues["Credit"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Debit  = Convert.ToDecimal(e.NewValues["Debit"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Price  = Convert.ToDecimal(e.NewValues["Price"]);
            var x1 = Convert.ToString(e.NewValues["DueDated"]).Substring(0, 10).Split('/');

            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].DueDated = x1[1] + "/" + x1[0] + "/" + x1[2];


            //((List<BEDocumentLine>)Session["asientoPrinc"])[index].DueDated = Convert.ToString(e.NewValues["DueDated"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Projectd = Convert.ToString(e.NewValues["Projectd"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].LineMemo = Convert.ToString(e.NewValues["LineMemo"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Ref1d    = Convert.ToString(e.NewValues["Ref1d"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Ref2d    = Convert.ToString(e.NewValues["Ref2d"]);
            ((List <BEDocumentLine>)Session["asientoPrinc"])[index].Ref3Line = Convert.ToString(e.NewValues["Ref3Line"]);

            // gdvAsiento.JSProperties["cpSubTotal"] = ((List<BEDocumentLine>)Session["inv1"]).Sum(item => Math.Round(item.LineTotal, 2));

            gdvAsiento.CancelEdit();
            e.Cancel = true;
            gdvAsiento.DataSource = ((List <BEDocumentLine>)Session["asientoPrinc"]);
            gdvAsiento.DataBind();
        }
Beispiel #16
0
        protected void gvDirecciones_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = gvDirecciones.EditingRowVisibleIndex;

            ((List <BEClientAddress>)Session["dire"])[index].Address        = Convert.ToString(e.NewValues["Address"]);
            ((List <BEClientAddress>)Session["dire"])[index].Street         = Convert.ToString(e.NewValues["Street"]);
            ((List <BEClientAddress>)Session["dire"])[index].State          = Convert.ToString(e.NewValues["State"]);
            ((List <BEClientAddress>)Session["dire"])[index].StateName      = Convert.ToString(e.NewValues["StateName"]);
            ((List <BEClientAddress>)Session["dire"])[index].Active         = Convert.ToString(e.NewValues["Active"]);
            ((List <BEClientAddress>)Session["dire"])[index].AdresType      = Convert.ToString(e.NewValues["AdresType"]);
            ((List <BEClientAddress>)Session["dire"])[index].U_DXP_BIZ_COPR = Convert.ToString(e.NewValues["U_DXP_BIZ_COPR"]);
            ((List <BEClientAddress>)Session["dire"])[index].U_DXP_BIZ_PROV = Convert.ToString(e.NewValues["U_DXP_BIZ_PROV"]);
            ((List <BEClientAddress>)Session["dire"])[index].U_DXP_BIZ_DIST = Convert.ToString(e.NewValues["U_DXP_BIZ_DIST"]);
            ((List <BEClientAddress>)Session["dire"])[index].U_DXP_BIZ_CODI = Convert.ToString(e.NewValues["U_DXP_BIZ_CODI"]);
            ((List <BEClientAddress>)Session["dire"])[index].U_DXP_BIZ_ZONA = Convert.ToString(e.NewValues["U_DXP_BIZ_ZONA"]);
            ((List <BEClientAddress>)Session["dire"])[index].GlblLocNum     = Convert.ToString(e.NewValues["GlblLocNum"]);
            ((List <BEClientAddress>)Session["dire"])[index].Building       = Convert.ToString(e.NewValues["Building"]);
            ((List <BEClientAddress>)Session["dire"])[index].StreetNo       = Convert.ToString(e.NewValues["StreetNo"]);

            Set_LineNum_Direcciones();
            gvDirecciones.CancelEdit();
            e.Cancel = true;
            gvDirecciones.DataSource = ((List <BEClientAddress>)Session["dire"]);
            gvDirecciones.DataBind();
        }
Beispiel #17
0
    protected void gvENT_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        //Get and Process the list of selected records in order to populate the list of pkvals
        #region process selected records
        var selected_keys = gvENT.GetSelectedFieldValues("actionID");


        ASPxCheckBox chkAllSelected    = gv.FindEditFormLayoutItemTemplateControl("chkUpdateAllSelected") as ASPxCheckBox;
        bool         updateALLSelected = chkAllSelected.Checked;


        List <int> pkvals = new List <int>();

        foreach (object key in e.Keys.Values)
        {
            int  ikey;
            bool isint = int.TryParse(key.ToString(), out ikey);
            if (isint)
            {
                pkvals.Add(ikey);
            }
        }

        //Add the other selected rows to the update if the user has selected the "Update All" checkbox
        if (selected_keys.Count > 0 && updateALLSelected)
        {
            foreach (object k in selected_keys)
            {
                int  ikey;
                bool isint = int.TryParse(k.ToString(), out ikey);
                if (!pkvals.Contains(ikey))
                {
                    pkvals.Add(ikey);
                }
            }
        }
        #endregion


        //Custom: retrieve specific data from the grid
        //Get the data from the ComboBoxes
        ASPxComboBox cboAS = (ASPxComboBox)gvENT.FindEditFormLayoutItemTemplateControl("CboAS");

        e.NewValues["actionstatusID"] = cboAS.Value;

        ASPxMemo notes = (ASPxMemo)gvENT.FindEditFormLayoutItemTemplateControl("notesEditor");
        e.NewValues["Notes"] = notes.Value;


        string result = dataops.dxGrid_UpdateData("actionID", pkvals, e.NewValues, "backend", "dbo", "tblAction");
        gvENTstatus.Text = result;

        gv.CancelEdit();
        e.Cancel = true;

        gvENT.DataBind();
    }
        protected void gvw_car_no_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView grid         = sender as ASPxGridView;
            var          cbb_car_area = grid.FindEditFormTemplateControl("cbb_car_area") as DevExpress.Web.ASPxEditors.ASPxComboBox;
            var          txt_car_no   = grid.FindEditFormTemplateControl("txt_car_no") as DevExpress.Web.ASPxEditors.ASPxTextBox;

            e.NewValues["car_no"] = cbb_car_area.Text + txt_car_no.Text;
        }
        protected override void RaiseRowUpdating(ASPxDataUpdatingEventArgs e)
        {
            OnBeforeRowUpdating_BaseImplementation(e);

            base.RaiseRowUpdating(e);

            OnAfterRowUpdating_BaseImplementation(e);
        }
Beispiel #20
0
    protected void dxgrid_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildUpdateSqlCode(e, GridnameToTable(gv.ClientInstanceName), "backend");
        gv.CancelEdit();
        e.Cancel = true;
    }
Beispiel #21
0
    protected void dxgrid_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildUpdateSqlCode(e, "tblStaff", "backend");
        gv.CancelEdit();
        e.Cancel = true;
    }
    protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            // Check updating right of user
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Create.Key,
                                       out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Get ColorEditor object
            var color = (ASPxColorEdit)((ASPxGridView)sender).FindEditFormTemplateControl("ColorEditHeaderBackColor");

            // Get PriorityIndex object
            var index = (ASPxSpinEdit)((ASPxGridView)sender).FindEditFormTemplateControl("index");

            #region Validating
            // Validate empty field
            if (!WebCommon.ValidateEmpty("Title", e.NewValues["Title"], out _message)
                || !WebCommon.ValidateEmpty("Color Code", color.Text, out _message)
                || !WebCommon.ValidateEmpty("Index", index.Value, out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }
            
            // Validate integer value for priority index
            int iIndex;
            if (!Int32.TryParse(index.Value.ToString().Trim(), out iIndex))
            {
                WebCommon.AlertGridView(sender, "Index value is invalid.");
                e.Cancel = true;
                return;
            }
            #endregion

            // Set value
            e.NewValues["Title"] = e.NewValues["Title"].ToString().Trim();
            e.NewValues["PriorityIndex"] = index.Value;
            e.NewValues["ColorCode"] = color.Text.Trim();
            e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["UpdateDate"] = DateTime.Now;

            // Show message alert delete successfully
            WebCommon.AlertGridView(sender, "Status is updated successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            e.Cancel = true;
            WebCommon.AlertGridView(sender, "Cannot update service. Please contact Administrator");
        }
    }
Beispiel #23
0
 protected void grdTitoliDiStudio_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     int id = Convert.ToInt32(e.Keys[0].ToString());
     string ddDescr = e.NewValues["dd_descrizione"].ToString();
     DALRuntime.updateTitolo(id, ddDescr);
     e.Cancel = true;
     grdTitoliDiStudio.CancelEdit();
     grdDataBind(true, true);
 }
        protected void grdvContratos_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            var obec  = ((BEParameters)Session["InitPar"]);
            var index = grdvContratos.EditingRowVisibleIndex;

            string[] x   = new string[15];
            DateTime?fch = new DateTime();

            //if(((List<BEAlmacen>)Session["oitw"])[index].Tiempo == "Existente")

            ((List <BEContratos>)Session["orcp"])[index].Code       = Convert.ToString(e.NewValues["Code"]);
            ((List <BEContratos>)Session["orcp"])[index].Dscription = Convert.ToString(e.NewValues["Dscription"]);
            ((List <BEContratos>)Session["orcp"])[index].Frequency  = Convert.ToString(e.NewValues["Frequency"]);
            ((List <BEContratos>)Session["orcp"])[index].Remind     = Convert.ToInt32(e.NewValues["Remind"]);
            ((List <BEContratos>)Session["orcp"])[index].DocNum     = Convert.ToString(e.NewValues["DocNum"]);
            ((List <BEContratos>)Session["orcp"])[index].StartDate  = Convert.ToDateTime(e.NewValues["StartDate"]);
            ((List <BEContratos>)Session["orcp"])[index].EndDate    = Convert.ToDateTime(e.NewValues["EndDate"]);
            ((List <BEContratos>)Session["orcp"])[index].EndDate2   = Convert.ToString(e.NewValues["EndDate2"]);
            var absentry = 0;

            if (((List <BEContratos>)Session["orcp"])[index].EndDate2 == "")
            {
                fch = null;
            }
            else
            {
                x   = ((List <BEContratos>)Session["orcp"])[index].EndDate2.Substring(0, 10).Split('/');
                fch = Convert.ToDateTime(x[1] + "/" + x[0] + "/" + x[2]);
            }

            ((List <BEContratos>)Session["orcp"]).Where(i => i.Code == Convert.ToString(e.NewValues["Code"]) &&
                                                        i.DocNum == Convert.ToString(e.NewValues["DocNum"]) &&
                                                        i.CardCode == Convert.ToString(e.NewValues["CardCode"])).ToList().ForEach(item =>
            {
                absentry = item.AbsEntry;
            });


            var obep = new BEParameters();

            obep.Socied       = obec.Socied;
            obep.accion       = 2;
            obep.AbsEntryUpdt = absentry;
            obep.FechaUpdt    = fch;
            obep.Descripcion  = ((List <BEContratos>)Session["orcp"])[index].Dscription;
            obep.DraftEntry   = 0;

            var obrd = new BRDocument();

            obrd.CRUD_CONTRATO(obep);
            var olst = obrd.DXP_GET_CONTRATOS(obep);

            grdvContratos.CancelEdit();
            e.Cancel = true;
            grdvContratos.DataSource = olst;
            grdvContratos.DataBind();
        }
Beispiel #25
0
    protected void gv2_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        string categoryName = e.NewValues["ProductName"].ToString();

        // Remove this block to allow editing
        ASPxGridView gv = sender as ASPxGridView;

        e.Cancel = true;
        gv.CancelEdit();
    }
Beispiel #26
0
        public static void gvcrud_OnRowUpdating(ASPxGridView gv, ASPxDataUpdatingEventArgs e, string db, string tbl, string schema)
        {
            Debug.WriteLine(" ***** grid_OnRowUpdating");
            DxDbOps.BuildUpdateSqlCode(e, tbl, db, schema);

            //((ASPxGridView)sender).JSProperties["cpIsUpdated"] = gv.ClientInstanceName.ToString();
            gv.JSProperties["cpIsUpdated"] = gv.ClientInstanceName.ToString();
            gv.CancelEdit();
            e.Cancel = true;
        }
    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.
    }
        protected virtual void OnAfterRowUpdating_BaseImplementation(ASPxDataUpdatingEventArgs e)
        {
            if (DataSource is ISmartDataSourse)
            {
                DataSource.Dirty();

                e.Cancel = true;

                CancelEdit();
            }
        }
Beispiel #29
0
    protected void gridDict_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildUpdateSqlCode(e, "fld", "data", "def");
        //((ASPxGridView) sender).JSProperties["cpIsUpdated"] = gv.ClientInstanceName.ToString();
        gv.CancelEdit();
        e.Cancel = true;

        gridDict.DataBind();
    }
Beispiel #30
0
    protected void gridLinkedREDCapForm_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildUpdateSqlCode(e, "REDCap_Form", "data", "def");
        gv.CancelEdit();
        e.Cancel = true;
        Session["LinkedREDCapForm"] = null;

        LoadlinkedTables();
    }
Beispiel #31
0
        protected void gdvLotes_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            gdvLotes.DoRowValidation();
            var index = gdvLotes.EditingRowVisibleIndex;

            ((List <BELotes>)Session["lote"])[index].Cantidad = Convert.ToDecimal(e.NewValues["Cantidad"]);

            gdvLotes.CancelEdit();
            e.Cancel            = true;
            gdvLotes.DataSource = ((List <BELotes>)Session["lote"]);
            gdvLotes.DataBind();
        }
Beispiel #32
0
    protected void gvcrud_OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        ASPxGridView gv  = (ASPxGridView)sender;
        string       tbl = gv.ClientInstanceName;

        gvCRUD.gvcrud_OnRowUpdating(gv, e, "backend", tbl, "stf");

        if (gv.ClientInstanceName == "staff")
        {
            gv_staff.DataBind();
        }
    }
    protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        int     id = (int)e.OldValues["Id"];
        DataRow dr = CustomDataSource.Rows.Find(id);

        dr[0] = e.NewValues["Id"];
        dr[1] = e.NewValues["Data"];

        ASPxGridView grid = sender as ASPxGridView;

        grid.CancelEdit();
        e.Cancel = true;
    }
Beispiel #34
0
 protected void grdUtenti_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     int id = Convert.ToInt32(e.Keys[0].ToString());
     string ddLogin = e.NewValues["dd_login"].ToString();
     string ddNome = e.NewValues["dd_nome"].ToString();
     string ddCognome = e.NewValues["dd_cognome"].ToString();
     string ddPassword = e.NewValues["dd_password"].ToString();
     int czProfilo = getCzProfilo();
     string ddMail = e.NewValues["dd_mail"].ToString();
     DALRuntime.updateUtente(id, ddLogin, ddPassword, ddNome, ddCognome, ddMail, czProfilo);
     e.Cancel = true;
     grdUtenti.CancelEdit();
     grdDataBind(true, true);
 }
Beispiel #35
0
 protected void grdAQuestItem_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     ASPxGridView grdAQuestItem = sender as ASPxGridView;
     DALRuntime.TRecQuestItem recQuestItem = new DALRuntime.TRecQuestItem();
     recQuestItem.idAQuestItem = Convert.ToInt32(e.Keys[0].ToString());
     recQuestItem.ddDomanda = e.NewValues["dd_domanda"].ToString();
     recQuestItem.ddRisposte = e.NewValues["dd_risposte"].ToString();
     if (e.NewValues["dd_immagine"] != null)
       recQuestItem.ddImmagine = e.NewValues["dd_immagine"].ToString();
     if (e.NewValues["nr_order"] != null)
       recQuestItem.nrOrder = Convert.ToInt32(e.NewValues["nr_order"].ToString());
     recQuestItem.caQuestSezione = DALRuntime.IdAQuestSezione;
     recQuestItem.caQuest = DALRuntime.IdAQuest;
     recQuestItem.updateAQuestItem();
     e.Cancel = true;
     grdAQuestItem.CancelEdit();
 }
Beispiel #36
0
    /// <summary>
    /// Thuc hien cap nhat roster
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gridRoster_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        TransactionManager tm = DataRepository.Provider.CreateTransaction();
        try
        {
            tm.BeginTransaction();

            // Validate user right for updating
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Update.Key, out _message))//Kiem tra xem user co quyen cap nhat hay khong
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            var grid = sender as ASPxGridView;
            if (grid == null)
            {
                WebCommon.AlertGridView(sender, "Cannot find roster.");
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            var objStartTime = grid.FindEditFormTemplateControl("fromTimeEdit") as ASPxTimeEdit;
            var objStartDate = grid.FindEditFormTemplateControl("fromDateEdit") as ASPxDateEdit;
            var objEndTime = grid.FindEditFormTemplateControl("endTimeEdit") as ASPxTimeEdit;
            var objEndDate = grid.FindEditFormTemplateControl("endDateEdit") as ASPxDateEdit;
            var txtId = grid.FindEditFormTemplateControl("txtId") as ASPxTextBox;
            var radAllSimilar = grid.FindEditFormTemplateControl("radAllSimilar") as ASPxRadioButton;
            var radEnabledSimilar = grid.FindEditFormTemplateControl("radEnabledSimilar") as ASPxRadioButton;
            var doctor = grid.FindEditFormTemplateControl("choDoctorEdit") as ASPxComboBox;
            var rosterType = grid.FindEditFormTemplateControl("cboRosterTypeEdit") as ASPxComboBox;

            if (objStartTime == null || objStartDate == null || objEndTime == null || objEndDate == null
                || txtId == null || radAllSimilar == null || radEnabledSimilar == null || doctor == null || rosterType == null)
            {
                WebCommon.AlertGridView(sender, "Edit form is error.");
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Lay doctorUsername
            // Neu selected value la null thi mac dinh no bang empty
            var doctorUsername = string.Empty;
            if (doctor.SelectedItem != null)
            {
                doctorUsername = doctor.SelectedItem.Value.ToString();
            }

            // Lay roster type
            // Neu selected value la null thi mac dinh no bang empty
            var rosterTypeId = string.Empty;
            if (rosterType.SelectedItem != null)
            {
                rosterTypeId = rosterType.SelectedItem.Value.ToString();
            }

            // Validate empty field
            if (!WebCommon.ValidateEmpty("Doctor", doctorUsername, out _message)
                || !WebCommon.ValidateEmpty("Roster Type", rosterTypeId, out _message)
                || !WebCommon.ValidateEmpty("From Time", objStartTime.Text, out _message)
                || !WebCommon.ValidateEmpty("From Date", objStartDate.Text, out _message)
                || !WebCommon.ValidateEmpty("End Time", objEndTime.Text, out _message)
                || !WebCommon.ValidateEmpty("End Date", objEndDate.Text, out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Lay du lieu duoc nhap vao
            var rosterId = txtId.Text;
            var username = doctor.SelectedItem.Value.ToString();
            int intRosterTypeId;
            var note = e.NewValues["Note"].ToString().Trim();
            var startTime = (DateTime)objStartTime.Value;
            var startDate = (DateTime)objStartDate.Value;
            var endTime = (DateTime)objEndTime.Value;
            var endDate = (DateTime)objEndDate.Value;
            string errorMessage = string.Empty;

            if (!Int32.TryParse(rosterType.SelectedItem.Value.ToString(), out intRosterTypeId))
            {
                WebCommon.AlertGridView(sender, "Roster Type is invalid.");
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            #region Validate Time
            // Set lai ngay cho endtime de so sanh
            endTime = new DateTime(startTime.Year, startTime.Month, startTime.Day, endTime.Hour, endTime.Minute, 0);

            if (startTime >= endTime)
            {
                WebCommon.AlertGridView(sender, "End time must be greater than start time.");
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Tao thoi gian moi de kiem tra
            var newStartTime = new DateTime(startDate.Year, startDate.Month, startDate.Day, startTime.Hour, startTime.Minute, 0);
            var newEndTime = new DateTime(endDate.Year, endDate.Month, endDate.Day, endTime.Hour, endTime.Minute, 0);
            #endregion

            #region Kiem tra roster hien tai
            // Lay thong tin roster hien tai
            var currentRoster = DataRepository.RosterProvider.GetById(rosterId);

            // Kiem tra roster co ton tai hay khong
            if (currentRoster == null)
            {
                WebCommon.AlertGridView(sender, String.Format("Roster {0} is not existed.", txtId.Text));
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Kiem tra xem roster co phai da qua khong
            if (currentRoster.StartTime < DateTime.Now)
            {
                WebCommon.AlertGridView(sender, String.Format("Roster {0} is passed.", txtId.Text));
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Kiem tra appointment, chua lam
            DataRepository.RosterProvider.DeepLoad(currentRoster);
            if (currentRoster.AppointmentCollection.Any(appointment => appointment.StartTime < newStartTime || appointment.EndTime > newEndTime))
            {
                errorMessage += String.Format("<br />Cannot change roster {0} because there are some appointments.", currentRoster.Id);
            }
            #endregion

            // Neu similar roster duoc chon
            if ((radAllSimilar.Checked || radEnabledSimilar.Checked) && currentRoster.RepeatId != null)
            {
                int count;
                var lstSimilar = DataRepository.RosterProvider.GetPaged(
                    String.Format("IsDisabled = 'False' AND RepeatId = '{0}' AND Id <> '{1}'", currentRoster.RepeatId, currentRoster.Id)
                    , "Id desc", 0, ServiceFacade.SettingsHelper.GetPagedLength, out count);
                DataRepository.RosterProvider.DeepLoad(lstSimilar);
                foreach (var roster in lstSimilar)
                {
                    // Kiem tra xem roster co phai da qua khong, dong thoi neu loai update la all, neu la enabled thi ko can bao loi
                    if (roster.StartTime < DateTime.Now)
                    {
                        if (radAllSimilar.Checked)
                        {
                            errorMessage += String.Format("<br />Roster {0} is passed.", roster.Id);
                        }
                        continue;
                    }

                    // Neu roster da co appointment thi bao loi
                    // Cho nay chua them column roster trong appointment nen chua kiem tra duoc
                    if (roster.AppointmentCollection.Any(appointment => appointment.StartTime < newStartTime || appointment.EndTime > newEndTime))
                    {
                        errorMessage += String.Format("<br />Cannot change roster {0} because there are some appointments.", currentRoster.Id);
                    }

                    roster.StartTime = new DateTime(roster.StartTime.Year, roster.StartTime.Month, roster.StartTime.Day
                        , startTime.Hour, startTime.Minute, 0);
                    roster.EndTime = new DateTime(roster.EndTime.Year, roster.EndTime.Month, roster.EndTime.Day
                        , endTime.Hour, endTime.Minute, 0);
                    roster.Note = note;
                    roster.RosterTypeId = intRosterTypeId;
                    roster.Username = username;
                    roster.UpdateUser = AccountSession.Session;
                    roster.UpdateDate = DateTime.Now;
                    DataRepository.RosterProvider.Save(tm, roster);
                }
            }

            if (errorMessage.Length > 0)
            {
                WebCommon.AlertGridView(sender, String.Format("There are some rosters error: {0}", errorMessage.Substring(0, errorMessage.Length - 1)));
                e.Cancel = true;
                tm.Rollback();
                return;
            }

            // Set pure value
            e.NewValues["Username"] = username;
            e.NewValues["RosterTypeId"] = intRosterTypeId;
            e.NewValues["StartTime"] = newStartTime;
            e.NewValues["EndTime"] = newEndTime;
            e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["UpdateDate"] = DateTime.Now;

            // Show message alert delete successfully
            tm.Commit();
            WebCommon.AlertGridView(sender, "Roster is updated successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            e.Cancel = true;
            tm.Rollback();
            WebCommon.AlertGridView(sender, "Cannot update roster. Please contact Administrator");
        }
    }
    protected void gridGroup_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Create.Key, out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Get grid
            var grid = sender as ASPxGridView;
            if (grid == null)
            {
                WebCommon.AlertGridView(sender, "Edit form is error.");
                e.Cancel = true;
                return;
            }

            // Validate empty field
            if (!WebCommon.ValidateEmpty("Title", e.NewValues["Title"], out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            e.NewValues["Username"] = e.NewValues["Title"].ToString().Trim();
            e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["UpdateDate"] = DateTime.Now;
            WebCommon.AlertGridView(sender, "Group is update successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            WebCommon.AlertGridView(sender, "Cannot update group. Please contact Administrator");
            e.Cancel = true;
        }
    }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void OnRowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     var x = e.Keys[0];
     //var y = e.
 }
Beispiel #39
0
 protected void grdPazienti_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     int id = Convert.ToInt32(e.Keys[0].ToString());
     DALRuntime.TRecPaziente recPaziente = getRecPaziente(e.NewValues, e.OldValues);
     ASPxGridView grdSender = (sender as ASPxGridView);
     // Legge i valori di ct_titolo e ct_stato_civile e li scrive in recPaziente
     readComboBox(recPaziente, grdSender);
     // Imposta id
     recPaziente.idPaziente = id;
     recPaziente.updatePaziente();
     e.Cancel = true;
     endEditAndRefresh();
 }
    protected void gridRoleDetail_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            // Validate user right for updating
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Update.Key, out _message))//Kiem tra xem user co quyen cap nhat hay khong
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Check null for grid role detail
            var grid = sender as ASPxGridView;
            if (grid == null)
            {
                WebCommon.AlertGridView(sender, _message);
                return;
            }

            var crud = GetStringCrudUpdate(sender, e);
            var roleId = grid.GetMasterRowKeyValue();

            // Validate empty field
            if (!WebCommon.ValidateEmpty("Role", roleId, out _message)
                || !WebCommon.ValidateEmpty("Screen", e.NewValues["ScreenCode"], out _message)
                || !WebCommon.ValidateEmpty("Right", crud, out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Set pure value
            e.NewValues["ScreenCode"] = e.NewValues["ScreenCode"].ToString().Trim();
            e.NewValues["RoleId"] = roleId;
            e.NewValues["Crud"] = crud;
            e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["UpdateDate"] = DateTime.Now;

            // Show message alert delete successfully
            WebCommon.AlertGridView(sender, "Role detail is updated successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            e.Cancel = true;
            WebCommon.AlertGridView(sender, "Cannot update role detail. Please contact Administrator");
        }
    }
    protected string GetStringCrudUpdate(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            string crud = string.Empty;

            // Validate null
            var asPxGridView = sender as ASPxGridView;
            if (asPxGridView == null)
            {
                return crud;
            }

            var gridColumn = asPxGridView.Columns["Right"] as GridViewDataColumn;

            var chkr = (ASPxCheckBox)asPxGridView.FindEditRowCellTemplateControl(gridColumn, "ckcR");
            var chku = (ASPxCheckBox)asPxGridView.FindEditRowCellTemplateControl(gridColumn, "ckcU");
            var chkd = (ASPxCheckBox)asPxGridView.FindEditRowCellTemplateControl(gridColumn, "ckcD");
            var chkc = (ASPxCheckBox)asPxGridView.FindEditRowCellTemplateControl(gridColumn, "ckcC");
            if (chkc.Checked) crud += OperationConstant.Create.Key;
            if (chkr.Checked) crud += OperationConstant.Read.Key;
            if (chku.Checked) crud += OperationConstant.Update.Key;
            if (chkd.Checked) crud += OperationConstant.Delete.Key;
            return crud;
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            return string.Empty;
        }
    }
 protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     ExpenseInfo item = Expenses.Where(x => x.ID == (String)e.Keys[0]).FirstOrDefault();
     if (item == null)
         throw new InvalidOperationException("Error locating expense record - please try again");
     UpdateExpense(item, e.NewValues);
     // cancel default updating
     e.Cancel = true;
     grid.CancelEdit();
 }
 protected void grid_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     e.NewValues["UpdateUser"] = WebCommon.GetAuthUsername();
     e.NewValues["UpdateDate"] = DateTime.Now;
     e.NewValues["IsDisabled"] = true;
 }
Beispiel #44
0
        protected void GridGroupDetail_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            string property = e.NewValues["N3_VALUE"].ToString();

            ASPxGridView gv = sender as ASPxGridView;
            e.Cancel = true;
            gv.CancelEdit();
        }
Beispiel #45
0
        protected void gv1temp_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
        {
            ASPxGridView gv = sender as ASPxGridView;
            gv.AddNewRow();

            e.Cancel = true;
            gv.CancelEdit();
            
        }        
    protected void gridRoom_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            // Validate user right for updating
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Update.Key, out _message))//Kiem tra xem user co quyen cap nhat hay khong
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Validate empty field
            if (!WebCommon.ValidateEmpty("Service", e.NewValues["ServicesId"], out _message)
                || !WebCommon.ValidateEmpty("Title", e.NewValues["Title"], out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Validate integer value for service id
            int iIndex;
            if (!Int32.TryParse(e.NewValues["ServicesId"].ToString().Trim(), out iIndex))
            {
                WebCommon.AlertGridView(sender, "Service is invalid.");
                e.Cancel = true;
                return;
            }

            // Set pure value
            e.NewValues["Title"] = e.NewValues["Title"].ToString().Trim();
            e.NewValues["CreateUser"] = e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["CreateDate"] = e.NewValues["UpdateDate"] = DateTime.Now;

            // Show message alert delete successfully
            WebCommon.AlertGridView(sender, "Room is updated successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            e.Cancel = true;
            WebCommon.AlertGridView(sender, "Cannot update room. Please contact Administrator");
        }
    }
        protected override void RaiseRowUpdating(ASPxDataUpdatingEventArgs e)
        {
            OnBeforeRowUpdating_BaseImplementation(e);

            base.RaiseRowUpdating(e);

            OnAfterRowUpdating_BaseImplementation(e);
        }
        protected virtual void OnAfterRowUpdating_BaseImplementation(ASPxDataUpdatingEventArgs e)
        {
            if (DataSource is ISmartDataSourse)
            {
                DataSource.Dirty();

                e.Cancel = true;

                CancelEdit();
            }
        }
 protected virtual void OnBeforeRowUpdating_BaseImplementation(ASPxDataUpdatingEventArgs e)
 {
 }
    /// <summary>
    /// Cap nhat thong tin mot patient
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void gridPatient_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            // Check update right
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Update.Key, out _message))
            {
                e.Cancel = true;
                return;
            }

            // Get grid
            var grid = sender as ASPxGridView;
            if (grid == null)
            {
                WebCommon.AlertGridView(sender, "Cannot find patient.");
                e.Cancel = true;
                return;
            }

            // Get control and validate
            var radMale = grid.FindEditFormTemplateControl("radMale") as ASPxRadioButton;
            var radFemale = grid.FindEditFormTemplateControl("radFemale") as ASPxRadioButton;

            if (radMale == null || radFemale == null)
            {
                WebCommon.AlertGridView(sender, "Edit form is error.");
                e.Cancel = true;
                return;
            }

            // Validate empty field
            if (!WebCommon.ValidateEmpty("First Name", e.NewValues["FirstName"], out _message)
                || !WebCommon.ValidateEmpty("Last Name", e.NewValues["LastName"], out _message)
                || !WebCommon.ValidateEmpty("DOB", e.NewValues["DateOfBirth"], out _message)
                || !WebCommon.ValidateEmpty("Nationality", e.NewValues["Nationality"], out _message)
                || !WebCommon.ValidateEmpty("Mobile Phone", e.NewValues["MobilePhone"], out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Validate empty field
            DateTime dtDOB;
            if (!DateTime.TryParse(e.NewValues["DateOfBirth"].ToString(), out dtDOB))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Get patient by Patient Code
            var patients = DataRepository.VcsPatientProvider.GetByPatientCode(e.OldValues["PatientCode"].ToString());
            if (patients == null || !patients.Any() || patients[0].IsDisabled)
            {
                WebCommon.AlertGridView(sender, "Cannot find patient.");
                e.Cancel = true;
                return;
            }

            var patient = patients[0];
            patient.FirstName = e.NewValues["FirstName"] == null ? null : e.NewValues["FirstName"].ToString();
            patient.MiddleName = e.NewValues["MiddleName"] == null ? null : e.NewValues["MiddleName"].ToString();
            patient.LastName = e.NewValues["LastName"] == null ? null : e.NewValues["LastName"].ToString();
            patient.Sex = radMale.Checked
                       ? SexConstant.Male.Value
                       : radFemale.Checked ? SexConstant.Female.Value : string.Empty;
            patient.DateOfBirth = dtDOB;
            patient.Nationality = e.NewValues["Nationality"] == null ? null : e.NewValues["Nationality"].ToString();
            patient.HomePhone = e.NewValues["HomePhone"] == null ? null : e.NewValues["HomePhone"].ToString();
            patient.MobilePhone = e.NewValues["MobilePhone"] == null ? null : e.NewValues["MobilePhone"].ToString();
            patient.CompanyCode = e.NewValues["CompanyCode"] == null ? null : e.NewValues["CompanyCode"].ToString();
            patient.ApptRemark = e.NewValues["ApptRemark"] == null ? null : e.NewValues["ApptRemark"].ToString();
            patient.UpdateUser = AccountSession.Session;
            DataRepository.VcsPatientProvider.Update(patient.PatientCode, patient.FirstName, patient.MiddleName, patient.LastName
                , patient.DateOfBirth, patient.Sex, patient.Nationality, patient.CompanyCode, patient.HomePhone, patient.MobilePhone
                , patient.UpdateUser, patient.ApptRemark, patient.IsDisabled);

            // Doan nay dung de fake cancel update
            var gridView = (ASPxGridView)sender;
            gridView.CancelEdit();
            WebCommon.AlertGridView(sender, "Patient is updated successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            WebCommon.AlertGridView(sender, "Cannot update patient. Please contact Administrator");
        }
        e.Cancel = true;
    }
    protected void gridUser_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
    {
        try
        {
            if (!RightAccess.CheckUserRight(AccountSession.Session, ScreenCode, OperationConstant.Create.Key, out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Get grid
            var grid = sender as ASPxGridView;
            if (grid == null)
            {
                WebCommon.AlertGridView(sender, "Edit form is error.");
                e.Cancel = true;
                return;
            }

            // Validate empty field
            if (!WebCommon.ValidateEmpty("Service", e.NewValues["ServicesId"], out _message)
                || !WebCommon.ValidateEmpty("Group", e.NewValues["UserGroupId"], out _message)
                || !WebCommon.ValidateEmpty("First Name", e.NewValues["Firstname"], out _message)
                || !WebCommon.ValidateEmpty("Last Name", e.NewValues["Lastname"], out _message)
                || !WebCommon.ValidateEmpty("Display Name", e.NewValues["DisplayName"], out _message))
            {
                WebCommon.AlertGridView(sender, _message);
                e.Cancel = true;
                return;
            }

            // Get control and validate
            var radMale = grid.FindEditFormTemplateControl("radMale") as ASPxRadioButton;
            var radFemale = grid.FindEditFormTemplateControl("radFemale") as ASPxRadioButton;
            var txtCPsw = grid.FindEditFormTemplateControl("txtCPsw") as ASPxTextBox;

            if (radMale == null || radFemale == null || txtCPsw == null)
            {
                WebCommon.AlertGridView(sender, "Add form is error.");
                e.Cancel = true;
                return;
            }

            // Validate service field
            int serviceId;
            if (!Int32.TryParse(e.NewValues["ServicesId"].ToString(), out serviceId))
            {
                WebCommon.AlertGridView(sender, "Service is invalid.");
                e.Cancel = true;
                return;
            }
            var service = DataRepository.ServicesProvider.GetById(serviceId);
            if (service == null || service.IsDisabled)
            {
                WebCommon.AlertGridView(sender, "Service is not existed.");
                e.Cancel = true;
                return;
            }

            // Validate group field
            var userGroup = DataRepository.UserGroupProvider.GetById(e.NewValues["UserGroupId"].ToString());
            if (userGroup == null || userGroup.IsDisabled)
            {
                WebCommon.AlertGridView(sender, "Group is not existed.");
                e.Cancel = true;
                return;
            }

            //// Check email is exists
            //string squery = string.Format("Email='{0}' and IsDisabled='False' and Username!='{1}'", e.NewValues["Email"], e.OldValues["Username"]);
            //int count;
            //if (DataRepository.UsersProvider.GetPaged(squery, "", 0, 0, out count).Any())
            //{
            //    WebCommon.AlertGridView(sender, "Email is existed.");
            //    e.Cancel = true;
            //    return;
            //}

            if (!string.IsNullOrEmpty(txtCPsw.Text))
            {
                e.NewValues["Password"] = Encrypt.EncryptPassword(txtCPsw.Text);
            }
            e.NewValues["Firstname"] = e.NewValues["Firstname"].ToString().Trim();
            e.NewValues["Lastname"] = e.NewValues["Lastname"].ToString().Trim();
            e.NewValues["DisplayName"] = e.NewValues["DisplayName"].ToString().Trim();
            e.NewValues["CellPhone"] = e.NewValues["CellPhone"] == null ? string.Empty : e.NewValues["CellPhone"].ToString().Trim();
            e.NewValues["Email"] = e.NewValues["Email"] == null ? string.Empty : e.NewValues["Email"].ToString().Trim();
            e.NewValues["Note"] = e.NewValues["Note"] == null ? string.Empty : e.NewValues["Note"].ToString().Trim();
            e.NewValues["UserGroupId"] = e.NewValues["UserGroupId"].ToString().Trim();
            e.NewValues["ServicesId"] = serviceId;
            e.NewValues["IsFemale"] = radFemale.Checked;
            e.NewValues["UpdateUser"] = AccountSession.Session;
            e.NewValues["UpdateDate"] = DateTime.Now;
            WebCommon.AlertGridView(sender, "User is update successfully.");
        }
        catch (Exception ex)
        {
            LoggerController.WriteLog(System.Runtime.InteropServices.Marshal.GetExceptionCode(), ex, Network.GetIpClient());
            WebCommon.AlertGridView(sender, "Cannot update user. Please contact Administrator");
            e.Cancel = true;
        }
    }
Beispiel #52
0
 protected void grdAQuestSezioni_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     int id = Convert.ToInt32(e.Keys[0].ToString());
     ASPxGridView grdAQuestSezione = sender as ASPxGridView;
     string ddDescr1 = e.NewValues["dd_descrizione1"].ToString();
     string ddDescr2 = e.NewValues["dd_descrizione2"].ToString();
     int caQuest = DALRuntime.IdAQuest;
     int nrNumScelte = Convert.ToInt32(e.NewValues["nr_num_scelte_possibili"].ToString());
     DALRuntime.updateAQuestSezione(id, ddDescr1, ddDescr2, caQuest, nrNumScelte);
     e.Cancel = true;
     grdAQuestSezione.CancelEdit();
 }
Beispiel #53
0
 protected void grdAQuest_RowUpdating(object sender, ASPxDataUpdatingEventArgs e)
 {
     int id = Convert.ToInt32(e.Keys[0].ToString());
     string ddDescr = e.NewValues["dd_descrizione"].ToString();
     string ddDescrBreve = e.NewValues["dd_descr_breve"].ToString();
     DALRuntime.updateAQuest(id, ddDescr, ddDescrBreve);
     e.Cancel = true;
     grdAQuest.CancelEdit();
     grdDataBind(true, true);
 }