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);
    }
Example #2
0
    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);
    }
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objCouponCode = new tblCouponCode();
         if (objCouponCode.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             ddlType.SelectedValue = objCouponCode.s_AppType;
             hdnType.Value         = objCouponCode.s_AppType;
             txtCouponCode.Text    = objCouponCode.s_AppCouponCode;
             txtDiscountPer.Text   = objCouponCode.s_AppDiscountPer;
             txtStartDate.Text     = objCouponCode.AppStartDate.ToString("dd-MM-yyyy");
             txtEndDate.Text       = objCouponCode.AppEndDate.ToString("dd-MM-yyyy");
             chkIsActive.Checked   = objCouponCode.AppIsActive;
             if (objCouponCode.AppType == Convert.ToInt32(Enums.Enum_CouponCodeType.General))
             {
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "HideTab()", true);
             }
             LoadAllData();
         }
         objCouponCode = null;
     }
 }
Example #4
0
 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;
         }
     }
 }