protected void btnSaveSubCategory_Click(object sender, EventArgs e)
 {
     if (SaveSubCategoryData())
     {
         if (string.IsNullOrEmpty(hdnSubCategoryId.Value))
         {
             DInfoSubCategory.ShowMessage("Size Sub Category  has been added successfully", Enums.MessageType.Successfull);
         }
         else
         {
             DInfoSubCategory.ShowMessage("Size Sub Category  has been updated successfully", Enums.MessageType.Successfull);
         }
         ResetSubCategoryControl();
         LoadSubCategoryData(false, false);
     }
 }
 protected void btnSaveCourierRate_Click(object sender, EventArgs e)
 {
     if (SaveCourierRateData())
     {
         if (string.IsNullOrEmpty(hdnCourierRateId.Value))
         {
             DInfoSubCategory.ShowMessage("Courier Rate  has been added successfully", Enums.MessageType.Successfull);
         }
         else
         {
             DInfoSubCategory.ShowMessage("Courier Rate  has been updated successfully", Enums.MessageType.Successfull);
         }
         ResetCourierRateControl();
         LoadCourierRateData(false, false);
     }
 }
    protected void btnCourierRateDelete_Click(object sender, EventArgs e)
    {
        string[] arIDs    = hdnSelectedIDs.Value.ToString().TrimEnd(',').Split(',');
        bool     IsDelete = false;

        for (int i = 0; i <= arIDs.Length - 1; i++)
        {
            if (!string.IsNullOrEmpty(arIDs.GetValue(i).ToString()))
            {
                if (DeleteCourierRate(Convert.ToInt32(arIDs.GetValue(i))))
                {
                    IsDelete = true;
                }
            }
        }

        if (IsDelete)
        {
            LoadCourierRateData(false, false);
        }
        DInfoSubCategory.ShowMessage("Courier Rate has been deleted successfully", Enums.MessageType.Successfull);
        hdnSelectedIDs.Value = "";
    }
    private bool SaveCourierRateData()
    {
        if (hdnPKID.Value != "")
        {
            objCommon = new clsCommon();
            if (objCommon.IsRecordExists("tblCourierRate", tblCourierRate.ColumnNames.AppPinCodeID, tblCourierRate.ColumnNames.AppCourierRateID, ddlPINCode.SelectedValue, "", tblCourierRate.ColumnNames.AppCourierCompanyID + "=" + hdnPKID.Value + " and " + tblCourierRate.ColumnNames.AppMinWeight + "=" + txtMinWeight.Text + " and " + tblCourierRate.ColumnNames.AppMaxWeight + "=" + txtMaxWeight.Text + " and " + tblCourierRate.ColumnNames.AppIsCOD + "='" + chkIsCOD.Checked + "'"))
            {
                ddlPINCode.SelectedIndex = 0;
                DInfoSubCategory.ShowMessage("Data for the same already exits.", Enums.MessageType.Error);
                return(false);
            }
            objCourierRate = new tblCourierRate();

            if (!string.IsNullOrEmpty(hdnCourierRateId.Value) && hdnCourierRateId.Value != "")
            {
                objCourierRate.LoadByPrimaryKey(Convert.ToInt32(hdnCourierRateId.Value));
            }
            else
            {
                objCourierRate.AddNew();
            }
            objCourierRate.AppPinCodeID          = Convert.ToInt32(ddlPINCode.SelectedValue.ToString());
            objCourierRate.s_AppCourierCompanyID = hdnPKID.Value;
            objCourierRate.s_AppMinWeight        = txtMinWeight.Text;
            objCourierRate.s_AppMaxWeight        = txtMaxWeight.Text;
            objCourierRate.s_AppRate             = txtRate.Text;
            objCourierRate.AppIsCOD = chkIsCOD.Checked;
            objCourierRate.Save();
            objCourierRate = null;
            objCommon      = null;
            return(true);
        }
        else
        {
            return(false);
        }
    }