private bool SaveData() { objCommon = new clsCommon(); if (objCommon.IsRecordExists("tblCouponCode", tblCouponCode.ColumnNames.AppCouponCode, tblCouponCode.ColumnNames.AppCouponCodeID, txtCouponCode.Text, hdnPKID.Value)) { DInfo.ShowMessage("Coupon Code alredy exits.", Enums.MessageType.Error); return(false); } objCouponCode = new tblCouponCode(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objCouponCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objCouponCode.AddNew(); } objCouponCode.AppCouponCode = txtCouponCode.Text; objCouponCode.s_AppDiscountPer = txtDiscountPer.Text; objCouponCode.s_AppStartDate = txtStartDate.Text; objCouponCode.s_AppEndDate = txtEndDate.Text; objCouponCode.AppIsActive = chkIsActive.Checked; objCouponCode.s_AppType = ddlType.SelectedValue; objCouponCode.Save(); intPkId = objCouponCode.AppCouponCodeID; objCouponCode = null; objCommon = null; return(true); }
private bool Delete(int intPKID) { bool retval = false; objCouponCode = new tblCouponCode(); if (objCouponCode.LoadByPrimaryKey(intPKID)) { objCouponCode.MarkAsDeleted(); objCouponCode.Save(); retval = true; } objCouponCode = null; return(retval); }
protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { if (e.CommandName == "IsActive") { objCouponCode = new tblCouponCode(); if (objCouponCode.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()))) { if (objCouponCode.AppIsActive == true) { objCouponCode.AppIsActive = false; } else if (objCouponCode.AppIsActive == false) { objCouponCode.AppIsActive = true; } objCouponCode.Save(); LoadDataGrid(false, false); } objCouponCode = null; } } }