protected void grdCokeSupplier_RowEditing(object sender, GridViewEditEventArgs e) { try { lblMsg.Text = string.Empty; lblMsg.Visible = false; //grdCokeSupplier.EditIndex = -1; //grdCokeSupplier.EditIndex = e.NewEditIndex; // Guid guid = ML_Common.String2Guid(grdCokeSupplier.DataKeys[e.NewEditIndex].Values[0].ToString()); //int lngId = ML_Common.string2int(grdCokeSupplier.DataKeys[e.NewEditIndex].Values[0].ToString()); int lngId = ML_Common.string2int32(grdCokeSupplier.DataKeys[e.NewEditIndex].Values[0].ToString()); if (lngId > 0) { ViewState["grdCokeSupplierId"] = lngId; grdCokeSupplier.EditIndex = -1; e.Cancel = true; FormFieldsClear(); FillObjectToForm(lngId, true); UpdatePanelEdit.Update(); ModalPopupExtenderEdit.Show(); } else { lblMsg.Text = "Record is not exists?"; lblMsg.Visible = true; } } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } }
protected void grdUserName_RowEditing(object sender, GridViewEditEventArgs e) { try { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; lblMsg.Visible = false; lblMsgEdit.Visible = false; int lngId = ML_Common.string2int32(grdUserName.DataKeys[e.NewEditIndex].Values[0].ToString()); if (lngId > 0) { ViewState["grdUserNameEditId"] = lngId; grdUserName.EditIndex = -1; e.Cancel = true; FormFieldsClear(); FillObjectToForm(lngId, true); UpdatePanelEdit.Update(); ModalPopupExtenderEdit.Show(); } else { lblMsg.Visible = true; lblMsg.Text = "Record is not exists?"; } } catch (Exception ex) { Exception exc = ex; } }
protected void EditButtonClick(object sender, CommandEventArgs e) { int teamID = int.Parse((string)e.CommandArgument); Team team = DatabaseFunctions.GetTeams(leagueID)[teamID]; TextBoxTeamName.Text = team.TeamName; CheckBoxHide.Checked = team.hidden; LabelGolfer1.Text = team.Golfer1Name; LabelGolfer2.Text = team.Golfer2Name; btnSaveEdits.CommandArgument = teamID.ToString(); ModalPopupExtenderEdit.Show(); }
protected void btnUserTypeEditCancelPopup_Click(object sender, EventArgs e) { ModalPopupExtenderEdit.Hide(); }
protected void BtnEdit_Click(object sender, EventArgs e) { // get row index GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent; int index = gvRow.RowIndex; ModalPopupExtenderEdit.Show(); this.LbNd.Text = this.GVDosen.Rows[index].Cells[0].Text; string CS = ConfigurationManager.ConnectionStrings["MainDb"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { try { con.Open(); SqlCommand CmdDosen = new SqlCommand("SpCariDosen", con); CmdDosen.CommandType = System.Data.CommandType.StoredProcedure; CmdDosen.Parameters.AddWithValue("@input", this.GVDosen.Rows[index].Cells[0].Text); using (SqlDataReader rdr = CmdDosen.ExecuteReader()) { if (rdr.HasRows) { while (rdr.Read()) { this.TbEditNama.Text = rdr["nama"].ToString(); this.DLEditProdi.SelectedValue = rdr["prodi"].ToString(); // ----- gender ----/ if (rdr["gender"] == DBNull.Value) { this.DLEditGender.SelectedValue = "gender"; } else if (rdr["gender"].ToString() == "M") { this.DLEditGender.SelectedItem.Text = "Laki-laki"; } else if (rdr["gender"].ToString() == "F") { this.DLEditGender.SelectedItem.Text = "Perempuan"; } // ----- agama ----- / if (rdr["agama"] == DBNull.Value) { this.DLEditAgama.SelectedValue = "-1"; } else { this.DLEditAgama.SelectedItem.Text = rdr["agama"].ToString(); } //----- tgl lahir ----/ if (rdr["tglahir"] == DBNull.Value) { this.TBEditTgLahir.Text = ""; } else { DateTime TglLahir = Convert.ToDateTime(rdr["tglahir"]); this.TBEditTgLahir.Text = TglLahir.ToString("yyyy-MM-dd"); } // ----alamat -----/ if (rdr["alamat"] == DBNull.Value) { this.TbEditAlamat.Text = ""; } else { this.TbEditAlamat.Text = rdr["alamat"].ToString(); } // ------ HP -----/ if (rdr["hp"] == DBNull.Value) { this.TbEditHp.Text = ""; } else { this.TbEditHp.Text = rdr["hp"].ToString(); } // ------ E-Mail -----/ if (rdr["email"] == DBNull.Value) { this.TbEditEmail.Text = ""; } else { this.TbEditEmail.Text = rdr["email"].ToString(); } } } } } catch (Exception ex) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), "ex", "alert('" + ex.Message.ToString() + "');", true); return; } } }
protected void btnCokeSupplierEditCancelPopup_Click(object sender, EventArgs e) { ModalPopupExtenderEdit.Hide(); }
protected void btnUpdate_Click(object sender, EventArgs e) { lblMsg.Text = string.Empty; lblMsgEdit.Text = string.Empty; if (IsValid) { //errNumber = -1; BusinessClass objBusinessClass = new BusinessLayer.BusinessClass(); int lngId = Convert.ToInt32(ViewState["grdCokeSupplierId"]); ML_CokeSupplier objML_CokeSupplier = objBusinessClass.GetCokeSupplierById(lngId); try { if (objML_CokeSupplier != null) { // objML_CokeSupplier.Id = ML_Common.string2int32(ML_Common.clean(txtIdEdit.Text)); // objML_CokeSupplier.CokeSupplierId = ML_Common.string2int32(ML_Common.GetDropDownValue(ddlCokeSupplierEdit, true)); objML_CokeSupplier.CokeSupplier = ML_Common.string2string(txtCokeSupplierEdit.Text); objML_CokeSupplier.Address1 = ML_Common.clean(txtAddress1Edit.Text); objML_CokeSupplier.Address2 = ML_Common.clean(txtAddress2Edit.Text); objML_CokeSupplier.Address3 = ML_Common.clean(txtAddress3Edit.Text); objML_CokeSupplier.CityName = string.Empty; //ML_Common.clean(txtCityNameEdit.Text); objML_CokeSupplier.StateName = string.Empty; // ML_Common.clean(txtStateNameEdit.Text); objML_CokeSupplier.PinCode = string.Empty; //ML_Common.clean(txtPinCodeEdit.Text); objML_CokeSupplier.Title = string.Empty; // ML_Common.clean(txtTitleEdit.Text); objML_CokeSupplier.CountryName = string.Empty; // ML_Common.clean(txtCountryNameEdit.Text); objML_CokeSupplier.ContactPerson = ML_Common.clean(txtContactPersonEdit.Text); objML_CokeSupplier.MobNo = ML_Common.clean(txtMobNoEdit.Text); objML_CokeSupplier.WebSite = string.Empty;// ML_Common.clean(txtWebSiteEdit.Text); objML_CokeSupplier.Email = ML_Common.clean(txtEmailEdit.Text); objML_CokeSupplier.Remarks = ML_Common.clean(txtRemarksEdit.Text); objML_CokeSupplier.IsActive = ML_Common.clean(ML_Common.bit2int(true).ToString()); objML_CokeSupplier.IsArchive = ML_Common.clean(ML_Common.bit2int(false).ToString()); objML_CokeSupplier.CreatedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.CreatedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.ModifiedDate = ML_Common.ToDateTimeSafe(System.DateTime.Now.ToString()); objML_CokeSupplier.ModifiedBy = ML_Common.clean(string.Empty); objML_CokeSupplier.CreatedByUserNameId = 1;// ML_Common.string2int(ML_Common.clean(txtCreatedByUserNameIdEdit.Text)); // int obhReturn = objBusinessClass.UpdateUniqueCokeSupplier(objML_CokeSupplier); int obhReturn = objBusinessClass.UpdateCokeSupplier(objML_CokeSupplier); if (obhReturn == 1) { lblMsg.Visible = true; lblMsg.Text = "Record Update Successfully"; lblMsgEdit.Text = "Record Update Successfully"; ModalPopupExtenderEdit.Hide(); lblMsgEdit.Text = string.Empty; } else if (obhReturn == 2) { lblMsg.Text = "Record Already Exists!"; lblMsgEdit.Text = "Record Already Exists!"; lblMsg.Visible = true; ModalPopupExtenderEdit.Hide(); } else { lblMsg.Text = "Ooops!OtherIssue..."; lblMsgEdit.Text = "Ooops!OtherIssue..."; lblMsg.Visible = true; } FillGrid(); } } catch (SqlException sqlExc) { SqlException sqlExt = sqlExc; return; } catch (Exception ex) { Exception exc = ex;// LogManager.LogManager.WriteErrorLog(ex); } } }