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

            if (txtServiceName.Text.Trim() == "")
            {
                intErrorCnt++;
                strErrMsg = "Service Name should not be empty.<br />";
            }
            if (ddlCategory.SelectedIndex==0)
            {
                intErrorCnt++;
                strErrMsg += "Please Select Category.<br />";
            }

            if (txtNoPair.Text.Trim() == "")
            {
                txtNoPair.Text = "0";
            }
            if (intErrorCnt == 0)
            {
                ServeAtDoorstepData.ServiceDetails objData = new ServiceDetails();
                objData.ServiceID = Convert.ToInt32(strServiceID);
                objData.ServiceName = txtServiceName.Text.Trim();
                objData.ServiceDescription = txtServiceDesc.Text.Trim();
                objData.ServiceKeyword = txtServiceKey.Text.Trim();
                objData.ServiceType = txtServiceType.Text.Trim();
                objData.PriceRangeFrom = txtPriceRanFrom.Text.Trim();
                objData.PriceRangeTo = txtPriceRanTo.Text.Trim();
                objData.NoOfPair = Convert.ToInt32(txtNoPair.Text.Trim());
                objData.BrandName = txtBrandName.Text.Trim();
                objData.BrandType = txtBrandType.Text.Trim();
                objData.CategoryId = Convert.ToInt32(ddlCategory.SelectedItem.Value.ToString());

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

                ScriptManager.RegisterStartupScript(this, this.GetType(), "name", "parent.parent.GB_hide();", true);

                //StringBuilder sb = new StringBuilder();
                //sb.Append("window.opener.RefreshPage();");
                //sb.Append("window.close();");

                //ClientScript.RegisterClientScriptBlock(this.GetType(), "CloseWindowScript",
                //    sb.ToString(), true);

                Response.Write("<script>window.opener.location.reload();</script>");
            }
            else
            {
                divErrorMsg.InnerHtml = strErrMsg;
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int intErrorCnt = 0;
            string strErrMsg = "";

            if (txtServiceName.Text.Trim() == "")
            {
                intErrorCnt++;
                strErrMsg = "Service Name should not be empty.<br />";
            }
            if (ddlCategory.SelectedIndex == 0)
            {
                intErrorCnt++;
                strErrMsg += "Please Select Category.<br />";
            }

            if (txtNoPair.Text.Trim() == "")
            {
                txtNoPair.Text = "0";
            }
            if (intErrorCnt == 0)
            {
                ServeAtDoorstepData.ServiceDetails objData = new ServiceDetails();
                objData.ServiceID = Convert.ToInt32(hdnServiceId.Value.ToString());
                objData.ServiceName = txtServiceName.Text.Trim();
                objData.ServiceDescription = txtServiceDesc.Text.Trim();
                objData.ServiceKeyword = txtServiceKey.Text.Trim();
                objData.ServiceType = txtServiceType.Text.Trim();
                objData.PriceRangeFrom = txtPriceRanFrom.Text.Trim();
                objData.PriceRangeTo = txtPriceRanTo.Text.Trim();
                objData.NoOfPair = Convert.ToInt32(txtNoPair.Text.Trim());
                objData.BrandName = txtBrandName.Text.Trim();
                objData.BrandType = txtBrandType.Text.Trim();
                objData.CategoryId = Convert.ToInt32(ddlCategory.SelectedItem.Value.ToString());

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

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

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

            }
        }
 public int AddService(ServiceDetails serviceDetails)
 {
     try
     {
         DALComponent objDALRegister = new DALComponent();
         objDALRegister.SetParameters("@serviceID", SqlDbType.Int, 4, serviceDetails.ServiceID);
         objDALRegister.SetParameters("@serviceName", SqlDbType.VarChar, 50, serviceDetails.ServiceName);
         objDALRegister.SetParameters("@serviceDesc", SqlDbType.VarChar, 300, serviceDetails.ServiceDescription);
         objDALRegister.SetParameters("@serviceKeyw", SqlDbType.VarChar, 300, serviceDetails.ServiceKeyword);
         objDALRegister.SetParameters("@categoryId", SqlDbType.Int, 4, serviceDetails.CategoryId);
         objDALRegister.SetParameters("@serviceType", SqlDbType.VarChar, 50, serviceDetails.ServiceType);
         objDALRegister.SetParameters("@priceRangeFrom", SqlDbType.VarChar, 50, serviceDetails.PriceRangeFrom);
         objDALRegister.SetParameters("@priceRangeTo", SqlDbType.VarChar, 50, serviceDetails.PriceRangeTo);
         objDALRegister.SetParameters("@noOfPair", SqlDbType.Int, 4, serviceDetails.NoOfPair);
         objDALRegister.SetParameters("@brandName", SqlDbType.VarChar, 50, serviceDetails.BrandName);
         objDALRegister.SetParameters("@brandType", SqlDbType.VarChar, 50, serviceDetails.BrandType);
         objDALRegister.SetParameters("@idvalue", SqlDbType.Int, true);
         objDALRegister.SqlCommandText = "[CreateService]";
         int x = objDALRegister.CreateRecord();
         object y = objDALRegister.GetParameters("@idvalue");
         if (serviceDetails.ServiceID != 0)
             return serviceDetails.ServiceID;
         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());
     }
 }