/// <summary>
 /// Insert Title detail.
 /// </summary>
 /// <param name="xmlData">Data that converted into xml format.</param>
 /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
 public int InsertPayment(LookupBDto objLookupBDto)
 {
     Database db = null;
     DbCommand dbCmd = null;
     int Result = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand(DALHelper.USP_BOOKING_PAYMENT_MODE_INSERT);
         db.AddInParameter(dbCmd, "@PAYMENT_MODE_NAME", DbType.String, objLookupBDto.LookupName);
         db.AddInParameter(dbCmd, "@CREATED_BY", DbType.Int32, objLookupBDto.UserProfile.UserId);
         db.AddOutParameter(dbCmd, "@ISEXIST", DbType.Int32, 1);
         db.ExecuteNonQuery(dbCmd);
         Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@ISEXIST"));
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
     return Result;
 }
 /// <summary>
 /// Insert SecurityQuestion detail.
 /// </summary>
 /// <param name="xmlData">Data that converted into xml format.</param>
 /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
 public int InsertSecurityQuestion(LookupBDto SecurityQuestion)
 {
     Database db = null;
     DbCommand dbCmd = null;
     int Result = 0;
     try
     {
         db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
         dbCmd = db.GetStoredProcCommand(DALHelper.USP_ADMINISTRATION_SECURITY_QUESTION_INSERT);
         db.AddInParameter(dbCmd, "@SECURITY_QUESTION_DESC", DbType.String, SecurityQuestion.LookupName);
         db.AddInParameter(dbCmd, "@CREATED_BY", DbType.Int32, SecurityQuestion.UserProfile.UserId);
         db.AddOutParameter(dbCmd, "@ISEXIST", DbType.Int32, 1);
         db.ExecuteNonQuery(dbCmd);
         Result = Convert.ToInt32(db.GetParameterValue(dbCmd, "@ISEXIST"));
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         {
             throw ex;
         }
     }
     finally
     {
         DALHelper.Destroy(ref dbCmd);
     }
     return Result;
 }
        /// <summary>
        /// Update Output CheckList detail.
        /// </summary>
        /// <param name="xmlData">Data that converted into xml format.</param>
        /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>
        public  int UpdateOutputCheckList(LookupBDto objLookupBDto)
        { 
            Database db = null;
            DbCommand dbCmd = null;
            int result = 0;

            try
            {
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand("USP_ADMINISTRATOR_COMMON_OP_CL_UPDATE");
                db.AddInParameter(dbCmd, "@OUTPUT_CHECK_LIST_ID", DbType.Int32, objLookupBDto.LookupId);
                db.AddInParameter(dbCmd, "@OUTPUT_CHECK_LIST_NAME", DbType.String, objLookupBDto.LookupName);
                db.AddInParameter(dbCmd, "@MODIFIED_BY", DbType.Int32, objLookupBDto.UserProfile.UserId);
                result = db.ExecuteNonQuery(dbCmd);
            }

            catch (Exception ex)
            {
                bool reThrow;
                reThrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (reThrow)
                {
                    throw ex;
                }
            }

            finally
            {
                DALHelper.Destroy(ref dbCmd);
            }
            return result;
        }
        /// <summary>
        /// Insert Report detail.
        /// </summary>
        /// <param name="xmlData">Data that converted into xml format.</param>
        /// <returns>Returns 1 and 0; (1 indicates successful operation).</returns>

        public int InsertReport(LookupBDto objLookupBDto)
        {
            Database db = null;
            DbCommand dbCmd = null;
            int result = 0;
            
            try
            {
                db = DatabaseFactory.CreateDatabase(DALHelper.CRM_CONNECTION_STRING);
                dbCmd = db.GetStoredProcCommand("USP_ADMINISTRATOR_COMMON_REPORT_MASTER_INSERT");
                db.AddInParameter(dbCmd, "@REPORT_NAME", DbType.String, objLookupBDto.LookupName);
                db.AddInParameter(dbCmd, "@CREATED_BY", DbType.Int32, objLookupBDto.LookupId);
                result = db.ExecuteNonQuery(dbCmd);
            }
            catch (Exception ex)
            {
                bool reThrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (reThrow)
                {
                    throw ex;
                }
            }
            finally
            {
                DALHelper.Destroy(ref dbCmd);
            }
            return result;
        }
 private void Save()
 {
     try
     {
         int result = 0;
         objRegionLookup = new RegionLookupDal();
         objLookupBDto = new LookupBDto();
         objLookupBDto.LookupName = txtRegionShortName.Text;
         objLookupBDto.Description = txtRegionLongName.Text;
         objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objRegionLookup.InsertRegion(objLookupBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
             bisEdit = false;
         }
         else
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
             Master.MessageCssClass = "errorMessage";
         }
         BindGrid();
         Reset();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         { throw ex; }
     }
 }
 private void SaveInqFollowMode()
 {
     try
     {
         int result = 0;
         objInquiriesFollowsModeLookup = new InquiriesFollowsModeLookupDal();
         LookupBDto objReligion = new LookupBDto();
         objLookUpBDto = new LookupBDto();
         objLookUpBDto.LookupName = txtInquiriesFollowsMode.Text;
         objLookUpBDto.UserProfile = objAuthorizationBDto.UserProfile;
         result = objInquiriesFollowsModeLookup.InsertInquiriesFollowsMode(objLookUpBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
         }
         else
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
             Master.MessageCssClass = "errorMessage";
         }
         BindGrid();
         Reset();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         { throw ex; }
     }
 }
        protected void acbOutputCheckList_SaveClick(object sender, EventArgs e)
        {

            try
            {
                int result = 0;
                objAddressTypeLookup = new AddressTypeLookupDal();
                switch (acbOutputCheckList.SaveButton.CommandName)
                {
                    case "Save":
                        Save();
                        pnlAddNewMode.Visible = false;
                        acbOutputCheckList.EditableMode = false;

                        break;

                    case "Update":
                        try
                        {
                            objAddressTypeLookup = new AddressTypeLookupDal();
                            objLookupBDto = new LookupBDto();
                            if (ViewState[PageConstants.vsItemIndexes] != null)
                            {
                                htItemIndex = (Hashtable)(ViewState[PageConstants.vsItemIndexes]);
                            }
                            int OutputCheckListId = 0;
                            for (int i = 0; i < htItemIndex.Count; i++)
                            {
                                objAuthorizationBDto = new AuthorizationBDto();
                                objLookupBDto = new LookupBDto();

                                Label lblgrdOutputCheckList = (Label)radgrdOutputCheckList.Items[Convert.ToInt32(htItemIndex[i])].FindControl("lblgrdOutputCheckListEdit");
                                TextBox txtgrdOutputCheckList = (TextBox)radgrdOutputCheckList.Items[Convert.ToInt32(htItemIndex[i])].FindControl("txtgrdOutputCheckList");
                                OutputCheckListId = int.Parse(lblgrdOutputCheckList.Text);
                                objAddressTypeLookup = new AddressTypeLookupDal();
                                objLookupBDto = new LookupBDto();
                                objLookupBDto.LookupName = txtgrdOutputCheckList.Text;
                                objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
                                objLookupBDto.LookupId = OutputCheckListId;
                                result = objAddressTypeLookup.UpdateOutputCheckList(objLookupBDto);
                            }
                            if (result >= 1)
                            {
                                Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
                                Master.MessageCssClass = "successMessage";
                            }
                            else
                            {
                                Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
                                Master.MessageCssClass = "errorMessage";
                            }
                            BindGrid();
                            Reset();
                        }
                        catch (Exception ex) { }

                        result = objAddressTypeLookup.UpdateOutputCheckList(objLookupBDto);
                        if (result == 1)
                        {
                            acbOutputCheckList.DefaultMode = true;
                            Master.DisplayMessage(ConfigurationSettings.AppSettings["UpdateRecord"].ToString());
                            Master.MessageCssClass = "successMessage";

                            if (ViewState[PageConstants.vsItemIndexes] != null)
                                htItemIndex = (Hashtable)ViewState[PageConstants.vsItemIndexes];
                            for (int i = 0; i < htItemIndex.Count; i++)
                                radgrdOutputCheckList.Items[Convert.ToInt32(htItemIndex[i])].Edit = false;
                            bisEdit = false;
                            ViewState[PageConstants.vsItemIndexes] = null;
                            BindGrid();
                        }
                        else
                        {
                            Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Update].ToString());
                            Master.MessageCssClass = "errorMessage";
                        }
                        break;
                }
                objAddressTypeLookup = new AddressTypeLookupDal();
            }

            catch (Exception ex)
            {
                bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
                if (rethrow)
                { throw ex; }
            }
        }
 private void Update()
 {
     try
     {
         int result = 0;
         objAddressTypeLookup = new AddressTypeLookupDal();
         objLookupBDto = new LookupBDto();
         objLookupBDto.LookupName = txtOutputCheckListName.Text;
         objLookupBDto.UserProfile = objAuthorizationBDto.UserProfile;
         objLookupBDto.LookupId = 0;
         string CityName = txtOutputCheckListName.Text;
         Int32 modifyBy = Convert.ToInt32(objAuthorizationBDto.UserProfile);
         result = objAddressTypeLookup.UpdateOutputCheckList(objLookupBDto);
         if (result >= 1)
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[SuccessMessage.Save].ToString());
             Master.MessageCssClass = "successMessage";
         }
         else
         {
             Master.DisplayMessage(ConfigurationSettings.AppSettings[FailureMessage.Save].ToString());
             Master.MessageCssClass = "errorMessage";
         }
         BindGrid();
         Reset();
     }
     catch (Exception ex)
     {
         bool rethrow = ExceptionPolicy.HandleException(ex, DALHelper.DAL_EXP_POLICYNAME);
         if (rethrow)
         { throw ex; }
     }
 }