Beispiel #1
0
        public int UpdateSecurityProfile(SecurityProfileFormUI securityProfileFormUI, int id)
        {
            int result = 0;

            result = securityProfileFormDAL.UpdateSecurityProfile(securityProfileFormUI, id);
            return(result);
        }
Beispiel #2
0
        public int AddSecurityProfile(SecurityProfileFormUI securityProfileFormUI, ref int newProfileId)
        {
            int result = 0;

            result = securityProfileFormDAL.AddSecurityProfile(securityProfileFormUI, ref newProfileId);
            return(result);
        }
        public int AddSecurityProfile(SecurityProfileFormUI securityProfileFormUI, ref int newProfileId)
        {
            int result = 0;

            try
            {
                using (SqlConnection SupportCon = new SqlConnection(connectionString))
                {
                    SupportCon.Open();
                    SqlCommand sqlCmd = new SqlCommand("prSecurityProfileInsert", SupportCon);
                    sqlCmd.CommandType    = CommandType.StoredProcedure;
                    sqlCmd.CommandTimeout = commandTimeout;

                    sqlCmd.Parameters.Add("@SecurityProfileX", SqlDbType.VarChar, 50);
                    sqlCmd.Parameters["@SecurityProfileX"].Value = securityProfileFormUI.SecurityProfileX;

                    sqlCmd.Parameters.Add("@CreatedOnDate", SqlDbType.DateTime);
                    sqlCmd.Parameters["@CreatedOnDate"].Value = securityProfileFormUI.CreatedOn;

                    sqlCmd.Parameters.Add("@UpdatedOnDate", SqlDbType.DateTime);
                    sqlCmd.Parameters["@UpdatedOnDate"].Value = securityProfileFormUI.UpdatedOn;

                    sqlCmd.Parameters.Add("@SecurityProfile", SqlDbType.Int);
                    sqlCmd.Parameters["@SecurityProfile"].Direction = ParameterDirection.Output;

                    result = sqlCmd.ExecuteNonQuery();

                    if (result == -1)
                    {
                        newProfileId = Convert.ToInt32(sqlCmd.Parameters["@SecurityProfile"].Value.ToString());
                    }

                    sqlCmd.Dispose();
                    SupportCon.Close();
                }
            }
            catch (Exception exp)
            {
                logExcpUIobj.MethodName       = "AddSecurityProfile()";
                logExcpUIobj.ResourceName     = "SecurityProfileFormDAL.CS";
                logExcpUIobj.RecordId         = "";
                logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString();
                logExcpDALobj.SaveExceptionToDB(logExcpUIobj);

                log.Error("[SecurityProfileFormDAL : AddSecurityProfile] An error occured in the processing of Record. Details : [" + exp.ToString() + "]");
            }

            return(result);
        }