protected void ASPxMenu3_ItemClick(object source, DevExpress.Web.MenuItemEventArgs e) { if (ValidarConexionYUsuarioLogueado(source)) { switch (e.Item.Name) { case "btnGmap": Session["codeRoute"] = ASPxTextBox4.Text; ASPxPopupControl6.ShowOnPageLoad = true; break; case "btnUpdate": if (ASPxTextBox1.Text == "") { try { var rowHandle = ASPxGridView1.FocusedRowIndex; var id = ASPxGridView1.GetDataRow(rowHandle).ItemArray[0].ToString(); _result = _objRoute.UpdateRoute(Session["connectionString"].ToString(), id, ASPxTextBox2.Text, ASPxTextBox3.Text, ASPxMemo1.Text, "10/10/2010", _user); if (_result != "OK") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetRoute(); Clean(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } } else { try { if (GetIdentity(ASPxTextBox1.Text) == false) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: DATO YA EXISTE');", true); } else { _result = _objRoute.InsertRoute(Session["connectionString"].ToString(), ASPxTextBox1.Text, ASPxTextBox2.Text, ASPxTextBox3.Text, ASPxMemo1.Text, "10/10/2010", Session["LOGIN"].ToString()); if (_result != "OK") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetRoute(); Clean(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } } break; } } }
protected void ASPxMenu3_ItemClick(object source, DevExpress.Web.MenuItemEventArgs e) { if (ValidarConexionYUsuarioLogueado(source)) { switch (e.Item.Name) { case "btnUpdate": if (ASPxTextBox1.Text == "") { try { int rowHandle = ASPxGridView1.FocusedRowIndex; string id = ASPxGridView1.GetDataRow(rowHandle).ItemArray[0].ToString(); _result = _objCustomer.UpdateCustomer(Session["connectionString"].ToString(), id, ASPxTextBox2.Text, ASPxComboBox1.Value.ToString(), ASPxTextBox3.Text, ASPxComboBox2.Value.ToString(), "10/10/2010", _user); if (_result != "OK") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetRoute(); GetCustomer(); GetClassification(); Clean(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } } else { try { if (GetIdentity(ASPxTextBox1.Text) == false) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: DATO YA EXISTE');", true); } else { _result = _objCustomer.InsertCustomer(Session["connectionString"].ToString(), ASPxTextBox1.Text, ASPxTextBox2.Text, ASPxComboBox1.Value.ToString(), ASPxTextBox3.Text, ASPxComboBox2.Value.ToString(), "10/10/2010", _user); if (_result != "OK") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetRoute(); GetCustomer(); GetClassification(); Clean(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } } break; } } }
protected void ASPxGridView2_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { ASPxGridView g2 = (ASPxGridView)sender; DataTable dataSourceSelectedValues = new DataTable(); dataSourceSelectedValues.Columns.Add(new DataColumn("CategoryID")); dataSourceSelectedValues.Columns.Add(new DataColumn("CategoryName")); dataSourceSelectedValues.Columns.Add(new DataColumn("Description")); dataSourceSelectedValues.Columns.Add(new DataColumn("LowerBound")); dataSourceSelectedValues.PrimaryKey = new DataColumn[] { dataSourceSelectedValues.Columns["CategoryID"] }; int indexSelectedValues = 0; Dictionary <object, int> lowerBoundStorage = Session["lowerBoundStorage"] as Dictionary <object, int>; if (lowerBoundStorage == null) { lowerBoundStorage = new Dictionary <object, int>(); } for (int i = 0; i < ASPxGridView1.VisibleRowCount; i++) { ASPxTextBox txtLowerBound = (ASPxTextBox)ASPxGridView1.FindRowCellTemplateControl(i, (GridViewDataColumn)ASPxGridView1.Columns["LowerBound"], "txtLB"); int lowerBound = 0; object key = ASPxGridView1.GetRowValues(i, "CategoryID"); if (txtLowerBound != null) { lowerBound = int.Parse(txtLowerBound.Text.Trim()); if (!lowerBoundStorage.ContainsKey(key)) { lowerBoundStorage.Add(key, lowerBound); } else { lowerBoundStorage[key] = lowerBound; } } else { if (lowerBoundStorage.ContainsKey(key)) { lowerBound = lowerBoundStorage[key]; } } if (ASPxGridView1.Selection.IsRowSelected(i)) { dataSourceSelectedValues.ImportRow(ASPxGridView1.GetDataRow(i)); DataRow dataRow = dataSourceSelectedValues.Rows[indexSelectedValues]; dataRow["LowerBound"] = lowerBound; indexSelectedValues++; } } Session["dataSourceSelectedValues"] = dataSourceSelectedValues; Session["lowerBoundStorage"] = lowerBoundStorage; g2.DataSource = Session["dataSourceSelectedValues"]; g2.DataBind(); }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnview") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["id"].ToString()); Response.Redirect("~/Finance_Module/ViewGLAccount.aspx?GlAccountID=" + id); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnview") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["BonceID"].ToString()); Response.Redirect("~/HR/ViewBonus.aspx?id=" + id); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnview") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["id"].ToString()); Response.Redirect("~/StudentAfair/ViewFollowup.aspx?id=" + id); } }
protected void ASPxGridView1_HtmlDataCellPrepared(object sender, ASPxGridViewTableDataCellEventArgs e) { e.Cell.Attributes.Add("onclick", string.Format("OnCellClick(this,{0},{1});", e.DataColumn.Index, e.VisibleIndex)); DataRow row = ASPxGridView1.GetDataRow(e.VisibleIndex); Point pt = new Point(e.DataColumn.Index, row.Table.Rows.IndexOf(row)); string color = cellColors[pt] as string; if (color != null) { e.Cell.Style["background-color"] = color; } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnDelete") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["id"].ToString()); string sql = "DELETE FROM [Std_Absent] WHERE ID=" + id; DataAccess.ExecuteSQLNonQuery(sql); Response.Redirect(Request.Url.AbsoluteUri); } }
protected void ASPxCallbackPanel1_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e) { string[] pars = e.Parameter.Split(';'); int index = Convert.ToInt32(pars[0]); if (pars[1] == "y") { AddRow(ASPxGridView1.GetDataRow(index)); } if (pars[1] == "n") { DeleteRow(ASPxGridView1.GetDataRow(index)); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["id"].ToString()); if (e.ButtonID == "btnview") { Response.Redirect("~/StudentAfair/ViewExam.aspx?id=" + id); } else if (e.ButtonID == "btnDegrees") { Response.Redirect("~/StudentAfair/AddExamDegree.aspx?id=" + id); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["EmpID"].ToString()); if (e.ButtonID == "btnview") { Response.Redirect("~/HR/ViewEmployee.aspx?id=" + id); } else { ASPxGridView1.SettingsEditing.Mode = (GridViewEditingMode)id; } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnView") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["ID"].ToString()); Response.Redirect("~/Inventory/ViewSupplier.aspx?id=" + id); } if (e.ButtonID == "btnActive") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); DataRow dr = ASPxGridView1.GetDataRow(Gid); int id = Convert.ToInt32(dr["ID"].ToString()); new ClsSupplier().Active(id); Response.Redirect(Request.Url.AbsoluteUri); } }
protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { if (e.Parameters.StartsWith("C|")) { string[] args = e.Parameters.Split('|'); if (args.Length < 3) { return; } for (int i = 2; i < args.Length; i++) { string[] pt = args[i].Split(','); DataRow row = ASPxGridView1.GetDataRow(Int32.Parse(pt[1])); Point point = new Point(Int32.Parse(pt[0]), row.Table.Rows.IndexOf(row)); cellColors[point] = args[1]; } } }
public void DeleteRowProvider() { try { var rowHandle = ASPxGridView1.FocusedRowIndex; var id = ASPxGridView1.GetDataRow(rowHandle).ItemArray[0].ToString(); _result = DeleteRoute(Session["connectionString"].ToString(), id); if (_result != "") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetRoute(); Clean(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } }
public void DeleteRowSku() { try { int rowHandle = ASPxGridView1.FocusedRowIndex; string id = ASPxGridView1.GetDataRow(rowHandle).ItemArray[0].ToString(); _result = DeleteSku(Session["connectionString"].ToString(), id); if (_result != "") { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); } GetSku(); GetFamily(); GetClassification(); GetProvider(); Clean(); GetMeasureUnit(); } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); } }
protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridViewCustomButtonCallbackEventArgs e) { if (e.ButtonID == "btnPay") { int Gid = Convert.ToInt32(e.VisibleIndex.ToString()); FillGrid(); DataRow dr = ASPxGridView1.GetDataRow(Gid); DataTable dt = ASPxGridView1.DataSource as DataTable; int id = Convert.ToInt32(dr["EmpID"].ToString()); dr["Paid"] = Convert.ToBoolean(true); for (int i = 0; i < dt.Rows.Count; i++) { new Employee().saveSallary(Convert.ToInt32(ddlMonth.SelectedValue.ToString()), Convert.ToInt32(ddlYear.SelectedValue.ToString()), 0, dt.Rows[i]); } Session["table"] = dt; /* dt.Rows.RemoveAt(Gid); * dt.Rows.InsertAt(dr,Gid);*/ //ASPxGridView1.DataSource = dt; ASPxGridView1.DataBind(); //Response.Redirect("~/HR/ViewEmployee.aspx?id=" + id); } }
protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e) { if (ValidarConexionYUsuarioLogueado(sender)) { string skus, res; switch (e.Parameters.Split('|')[0]) { case "ObtenerUnidadDeMedida": var codigoSkuSeleccionado = ASPxTextBox1.Text; var codigoUnidadDeMedida = UiListaUnidadesDeMedida.Value.ToString(); if (e.Parameters.Split('|')[1] == "0") { string isUpdate = e.Parameters.Split('|')[2]; if (UpdateButon(sender, isUpdate)) { InsertOrUpdatePackUnitSku(Session["connectionString"].ToString(), codigoUnidadDeMedida, codigoSkuSeleccionado); } } else { var rowHandle = ASPxGridView1.FocusedRowIndex; codigoSkuSeleccionado = ASPxGridView1.GetDataRow(rowHandle).ItemArray[1].ToString(); if (codigoSkuSeleccionado != "-1") { InsertOrUpdatePackUnitSku(Session["connectionString"].ToString(), codigoUnidadDeMedida, codigoSkuSeleccionado); } } GetSku(); GetFamily(); GetMeasureUnit(); break; case "RecargarDatos": GetSku(); GetFamily(); GetMeasureUnit(); break; case "ActivarSku": var skusActivate = ASPxGridView1.GetSelectedFieldValues("CODE_SKU"); var doc = new XDocument(); doc.Add(new XElement("SKU", skusActivate.Select(x => new XElement("CODE_SKU", x)))); skus = doc.ToString(); res = ActivateInvetory("1", skus); if (res == "Proceso Exitoso") { GetSku(); GetFamily(); GetMeasureUnit(); } else { EstablecerError(res, ASPxGridView1); } break; case "DesactivarSku": var skusDeactivate = ASPxGridView1.GetSelectedFieldValues("CODE_SKU"); var docdeac = new XDocument(); docdeac.Add(new XElement("SKU", skusDeactivate.Select(x => new XElement("CODE_SKU", x)))); skus = docdeac.ToString(); res = ActivateInvetory("0", skus); if (res == "Proceso Exitoso") { GetSku(); GetFamily(); GetMeasureUnit(); } else { EstablecerError(res, ASPxGridView1); } break; } } }
private bool UpdateButon(object sender, string isUpdate) { if (isUpdate == Enums.GetStringValue(SiNo.Si)) { try { if (ASPxCmbMed.Value == null) { ASPxCmbMed.Value = 0; } if (ASPxSpinMed.Value == null) { ASPxSpinMed.Value = 0; } if (ASPxSpinEditLong.Value == null) { ASPxSpinEditLong.Value = 0; } if (ASPxSpinEditWeight.Value == null) { ASPxSpinEditWeight.Value = 0; } if (ASPxSpinEditHigh.Value == null) { ASPxSpinEditHigh.Value = 0; } if (ASPxSpinEditVol.Value == null) { ASPxSpinEditVol.Value = 0; } if (ASPxCboFamSKU.Value == null) /* --------- */ { ASPxCboFamSKU.Value = 0; } var rowHandle = ASPxGridView1.FocusedRowIndex; string sapval = ASPxGridView1.GetDataRow(rowHandle).ItemArray[0].ToString(); if (sapval != "-1") { var id = ASPxGridView1.GetDataRow(rowHandle).ItemArray[1].ToString(); _result = _objSku.UpdateSku( Session["connectionString"].ToString(), id, ASPxMemo1.Text, ASPxComboBox1.Value.ToString(), ASPxTextBox2.Text, ASPxComboBox2.Value.ToString(), ASPxSpinEdit1.Text, "0", int.Parse(ASPxCmbMed.Value.ToString()), double.Parse(ASPxSpinMed.Value.ToString()), double.Parse(ASPxSpinEditVol.Value.ToString()), "10/10/2010", _user, ASPxComboBox4.Value.ToString(), ASPxComboBox5.Value.ToString(), double.Parse(ASPxSpinEditLong.Value.ToString()), double.Parse(ASPxSpinEditWeight.Value.ToString()), double.Parse(ASPxSpinEditHigh.Value.ToString()), ASPxCboFamSKU.Value.ToString(), int.Parse(UiListaDimencion.Value.ToString()) ); } else { EstablecerError("Error: No se puede actualizar SKU de SAP", sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: No se puede actualizar SKU de SAP');", true); return(false); } if (_result != "OK") { EstablecerError("Error: " + _result, sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); return(false); } GetSku(); GetFamily(); GetMeasureUnit(); GetProvider(); GetClassification(); Clean(); return(true); } catch (Exception ex) { EstablecerError("Error: " + ex.Message, sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); return(false); } } else { try { if (GetIdentity(ASPxTextBox1.Text) == false) { EstablecerError("Error: DATO YA EXISTE", sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: DATO YA EXISTE');", true); return(false); } else { if (ASPxCmbMed.Value == null) { ASPxCmbMed.Value = 0; } if (ASPxSpinMed.Value == null) { ASPxSpinMed.Value = 0; } if (ASPxSpinEditLong.Value == null) { ASPxSpinEditLong.Value = 0; } if (ASPxSpinEditWeight.Value == null) { ASPxSpinEditWeight.Value = 0; } if (ASPxSpinEditHigh.Value == null) { ASPxSpinEditHigh.Value = 0; } if (ASPxSpinEditVol.Value == null) { ASPxSpinEditVol.Value = 0; } if (ASPxCboFamSKU.Value == null) { ASPxCboFamSKU.Value = 0; } if (int.Parse(ASPxSpinMed.Value.ToString()) <= 0 || string.IsNullOrEmpty(ASPxCmbMed.Text)) { EstablecerError("Error: Si ingresa peso aproximado ingrese unidad de medida o viceversa", sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: Si ingresa peso aproximado ingrese unidad de medida o viceversa');", true); return(false); } _result = _objSku.InsertSku(Session["connectionString"].ToString(), ASPxTextBox1.Text, ASPxMemo1.Text, ASPxComboBox1.Value.ToString(), ASPxTextBox2.Text, ASPxComboBox2.Value.ToString(), ASPxSpinEdit1.Text, ASPxCmbMed.SelectedItem.Value.ToString(), int.Parse(ASPxCmbMed.Value.ToString()), double.Parse(ASPxSpinMed.Value.ToString()), double.Parse(ASPxSpinEditVol.Value.ToString()), "10/10/2010", _user, ASPxComboBox4.Value.ToString(), ASPxComboBox5.Value.ToString(), double.Parse(ASPxSpinEditLong.Value.ToString()), double.Parse(ASPxSpinEditWeight.Value.ToString()), double.Parse(ASPxSpinEditHigh.Value.ToString()), ASPxCboFamSKU.Value.ToString(), int.Parse(UiListaDimencion.Value.ToString())); if (_result != "OK") { EstablecerError("Error: " + _result, sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + _result + "');", true); return(false); } GetSku(); GetFamily(); GetMeasureUnit(); GetClassification(); GetProvider(); Clean(); return(true); } } catch (Exception ex) { EstablecerError("Error: " + ex.Message, sender); //ScriptManager.RegisterStartupScript(this, GetType(), "ErrorText", "CallError('Error: " + ex.Message + "');", true); return(false); } } }