protected void dgvCourierRate_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            objCommon = new clsCommon();
            hdnCourierRateId.Value = e.CommandArgument.ToString();
            if (e.CommandName == "IsCOD")
            {
                objCourierRate = new tblCourierRate();

                if (objCourierRate.LoadByPrimaryKey(Convert.ToInt32(hdnCourierRateId.Value)))
                {
                    if (objCourierRate.AppIsCOD == true)
                    {
                        objCourierRate.AppIsCOD = false;
                    }
                    else if (objCourierRate.AppIsCOD == false)
                    {
                        objCourierRate.AppIsCOD = true;
                    }
                    objCourierRate.Save();
                    LoadCourierRateData(false, false);
                }
                objCourierRate = null;
            }
        }
    }
    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);
        }
    }