/// <summary> /// Link Gove code click handler /// to allow edit this gov /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkDelete_Click(object sender, EventArgs e) { LinkButton lnk = (LinkButton)sender; GOVERNORATE delgov = new GOVERNORATE(); delgov.LoadByPrimaryKey(short.Parse(lnk.CommandArgument)); delgov.MarkAsDeleted(); delgov.Save(); Filter(""); }
protected void btnSave_Click(object sender, EventArgs e) { GOVERNORATE objGovInsUpd = new GOVERNORATE(); if (txtGoveName.Text.Trim() == "") { MHOCommon.ShowMessage("يجب ادخال اسم المحافظة", this.Page); return; } if (txtGoveCode.ReadOnly) { // update case objGovInsUpd.LoadByPrimaryKey(short.Parse(txtGoveCode.Text)); objGovInsUpd.DESCR = txtGoveName.Text.Trim(); objGovInsUpd.Save(); txtGoveCode.ReadOnly = false; Filter(""); //txtFilter.Text = ""; txtGoveCode.Text = ""; txtGoveName.Text = ""; btnSave.Text = "اضافة"; } else { try { //Insert case objGovInsUpd.AddNew(); objGovInsUpd.CD = short.Parse(txtGoveCode.Text); objGovInsUpd.DESCR = txtGoveName.Text.Trim(); objGovInsUpd.Save(); Filter(""); //txtFilter.Text = ""; txtGoveCode.Text = ""; txtGoveName.Text = ""; } catch { MHOCommon.ShowMessage("لقد حاولت ادخال كود موجود اوهناك خطأ فى البيانات", this.Page); } } }
/// <summary> /// Link Gove code click handler /// to allow edit this gov /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnkDelete_Click(object sender, EventArgs e) { LinkButton lnk = (LinkButton)sender; POLICE_STATION pol = new POLICE_STATION(); pol.Where.FK_GOVCD.Value = short.Parse(lnk.CommandArgument); pol.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; CIVIL_OFFICE civ = new CIVIL_OFFICE(); civ.Where.FK_GOVCD.Value = short.Parse(lnk.CommandArgument); civ.Where.FK_GOVCD.Operator = MyGeneration.dOOdads.WhereParameter.Operand.Equal; if (!pol.Query.Load() && !civ.Query.Load()) { GOVERNORATE delgov = new GOVERNORATE(); delgov.LoadByPrimaryKey(short.Parse(lnk.CommandArgument)); delgov.MarkAsDeleted(); delgov.Save(); Filter(""); } else { MHOCommon.ShowMessage("خطأ فى الحذف بسبب البيانات المرتبطة", this.Page); } }