protected void btnSave_Click(object sender, EventArgs e)
        {
            int intErrorCnt = 0;
            string strErrMsg = "";

            if (txtMemberName.Text.Trim() == "")
            {
                intErrorCnt++;
                strErrMsg = "Membership Name should not be empty.<br />";
            }
            if (intErrorCnt == 0)
            {
                ServeAtDoorstepData.MembershipDetails objData = new MembershipDetails();
                objData.MemberShipID = Convert.ToInt32(hdnMemberId.Value.ToString());
                objData.MemberShipName = txtMemberName.Text.Trim();
                objData.MemberShipType = txtMemberType.Text.Trim();
                objData.MemberShipAmount = Convert.ToDecimal(txtAmount.Text.Trim());
                objData.MemberShipDays = Convert.ToInt32(txtDays.Text.Trim());

                objService = new ServeAtDoorstepService();
                int i = objService.AddMembership(objData);

                this.ModalPopupViewMessage.Hide();
                BindMemberGrid();
                ClearData();

            }
            else
            {
                divErrorMsg.InnerHtml = strErrMsg;
                this.ModalPopupViewMessage.Show();

            }
        }
 public int AddMembership(MembershipDetails membershipDetails)
 {
     try
     {
         DALComponent objDALRegister = new DALComponent();
         objDALRegister.SetParameters("@memberShipID", SqlDbType.Int, 4, membershipDetails.MemberShipID);
         objDALRegister.SetParameters("@memberShipName", SqlDbType.VarChar, 50, membershipDetails.MemberShipName);
         objDALRegister.SetParameters("@memberShipType", SqlDbType.NChar, 10, membershipDetails.MemberShipType);
         objDALRegister.SetParameters("@memberShipAmount", SqlDbType.Decimal, 9, membershipDetails.MemberShipAmount);
         objDALRegister.SetParameters("@memberShipDays", SqlDbType.Int, 4, membershipDetails.MemberShipDays);
         objDALRegister.SetParameters("@idvalue", SqlDbType.Int, true);
         objDALRegister.SqlCommandText = "[CreateMembership]";
         int x = objDALRegister.CreateRecord();
         object y = objDALRegister.GetParameters("@idvalue");
         if (membershipDetails.MemberShipID != 0)
             return membershipDetails.MemberShipID;
         else
             return Int32.Parse(y.ToString());
     }
     catch (SqlException sqlEx)
     {
         throw new ApplicationException("Data error=" + sqlEx.Message.ToString());
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Error=" + ex.Message.ToString());
     }
 }