예제 #1
0
파일: SCT_DAL.cs 프로젝트: hari316/Projects
        /********************************************************************************************************/
        public SCT_CDeploy getCenterOfDeployment_DAL()
        {
            logger.Info("Method : getCenterOfDeployment_DAL Start");

            databaseLayer dbConStr = new databaseLayer();
            string connStr = dbConStr.connectionInfo;

            logger.Debug("Connection string : " + connStr);

            SqlConnection conn = new SqlConnection(connStr);

            if (conn.State == System.Data.ConnectionState.Closed)
            {
                conn.Open();
                logger.Debug("Connection Status opened ");
            }

            logger.Info("Connetion to the database established");

            try
            {

                string Query = "select code PE_ID,codedescription PE_DESC from codes where codetype='personnelarea' and displayorder=1";
                SqlCommand cmd_SCTDetails = new SqlCommand();
                cmd_SCTDetails.Connection = conn;
                cmd_SCTDetails.CommandText = Query;

                logger.Info("cmd_SCTDetails Query parameters initialised");

                QueryLog.CmdInfo(cmd_SCTDetails);

                SqlDataAdapter da_SCTDetails = new SqlDataAdapter();
                da_SCTDetails.SelectCommand = cmd_SCTDetails;
                DataSet dSet_SCTDetails = new DataSet();
                da_SCTDetails.Fill(dSet_SCTDetails);

                logger.Info("cmd_SCTDetails excuted by SqlDataAdapter()");

                int Details_count = dSet_SCTDetails.Tables[0].Rows.Count;

                logger.DebugFormat("Row Count : ItemDetails table {0}", Details_count.ToString());

                SCT_CDeploy result = new SCT_CDeploy(Details_count);

                if (Details_count > 0)
                {

                    result.SCT_header.StatusFlag = 0;
                    result.SCT_header.StatusMsg = SCT_Constants.Success;

                    int objCounter_item = 0;

                    foreach (DataRow item_dr in dSet_SCTDetails.Tables[0].Rows)
                    {
                        SCT_CDeploy.CDeploy Item = new SCT_CDeploy.CDeploy();
                        Item.ID = item_dr["PE_ID"].ToString();
                        Item.Label = item_dr["PE_DESC"].ToString();

                        result.SCT_Details[objCounter_item++] = Item;
                    }
                }

                else
                {
                    result.SCT_header.StatusFlag = 1;
                    result.SCT_header.StatusMsg = "No records Found";
                }

                logger.Info("Method : getCenterOfDeployment_DAL Stop");

                return result;

            }
            catch (SqlException dbEx)
            {
                logger.Fatal("Exception Occured At SCT_DAL - getCenterOfDeployment_DAL");
                logger.Debug("Exception Code : " + dbEx.Number.ToString());
                logger.Debug("Exception Description : " + dbEx.Message.ToString());
                logger.Error("Error : getCenterOfDeployment_DAL Stop");

                throw dbEx;
            }
            catch (Exception ex)
            {
                logger.Fatal("Exception Occured At SCT_DAL - getCenterOfDeployment_DAL  : " + ex.Message.ToString());
                logger.Error("Error : getCenterOfDeployment_DAL Stop");

                throw ex;
            }
            finally
            {
                logger.Debug("Connection Status Closed ");

                conn.Dispose();
            }
        }
예제 #2
0
파일: Service.cs 프로젝트: hari316/Projects
    public SCT_CDeploy getCenterOfDeployment()
    {
        logger.Info("Method : getCenterOfDeployment Start");

        try
        {
            SCT_CDeploy result = new SCT_CDeploy();
            SCTInterface CDevp_SI = new SCTInterface();
            result = CDevp_SI.getCenterOfDeployment_SI();

            logger.Info("Method : getCenterOfDeployment Stop");

            return result;
        }
        catch (SqlException ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            //string mailBody = string.Format(SCT_Constants.mail_BodyFormat,System.DateTime.Now.ToString("F"),PReqNo,ex.TargetSite.ToString(),ex.ToString());
            //webServiceExHandling.Send_Email(SCT_Constants.Email_Dic, mailBody);

            SCT_CDeploy Error = new SCT_CDeploy();
            Error.SCT_header.StatusFlag = ex.Number;
            string expCode = ExpType(ex);
            Error.SCT_header.StatusMsg = SCT_Constants.cnfgErrMessages[expCode];

            logger.Debug("Return object Error : Status Flag = " + Error.SCT_header.StatusFlag.ToString());
            logger.Debug("Return object Error : Status Message = " + Error.SCT_header.StatusMsg);
            logger.Error("Method : getCenterOfDeployment Stop");

            return Error;
        }

        catch (Exception ex)
        {
            webServiceExHandling.ExceptionLog(ex);
            //string mailBody = string.Format(SCT_Constants.mail_BodyFormat, System.DateTime.Now.ToString("F"), PReqNo, ex.TargetSite.ToString(), ex.ToString());
            //webServiceExHandling.Send_Email(SCT_Constants.Email_Dic, mailBody);

            SCT_CDeploy Error = new SCT_CDeploy();
            Error.SCT_header.StatusFlag = 1;
            Error.SCT_header.StatusMsg = SCT_Constants.Error;

            logger.Debug("Return object Error : ErrorCode = " + Error.SCT_header.StatusFlag.ToString());
            logger.Debug("Return object Error : ErrorMessage = " + Error.SCT_header.StatusMsg);
            logger.Error("Method : getCenterOfDeployment Stop");

            return Error;
        }
    }