Exemple #1
0
        /// <summary>
        /// This function Updates SCT Details into the Database 
        /// </summary>
        /// <param name="is_entry_DAL"></param>
        /// <returns>
        /// <paramref name="result"/>
        /// </returns>
        /// <history>
        ///     Hari haran      08/05/2012      created
        /// </history>
        public SCT_UpdateOutputEntity updateSCEmployeeDetails_DAL(SCT_UpdateInputEntity entry_DAL)
        {
            logger.Info("Method : updateSCEmployeeDetails_DAL Start");
            logger.DebugFormat("Input Parameter entry_BAL : EmpNo value = {0} and WEF = {1}", entry_DAL.EmpNo, entry_DAL.WEF);

            databaseLayer dbConStr = new databaseLayer();
            string connStr = dbConStr.connectionInfo;
            logger.Debug("Connection string : " + connStr);
            SqlConnection conn = new SqlConnection(connStr);
            SqlTransaction Trans = null;

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

            logger.Info("Connetion to the database established");
            try
            {
                SCT_UpdateOutputEntity result = new SCT_UpdateOutputEntity();

                SqlCommand insert_cmd = new SqlCommand();
                insert_cmd.Connection = conn;
                insert_cmd.CommandType = CommandType.StoredProcedure;
                Trans = conn.BeginTransaction("InsertTransaction");
                insert_cmd.Transaction = Trans;
                string insertQuery = "HRMSACInsertRequestChange";
                insert_cmd.CommandText = insertQuery;

                insert_cmd.Parameters.AddWithValue("@EMPNO", Convert.ToInt32(entry_DAL.EmpNo));
                insert_cmd.Parameters.AddWithValue("@REASON", entry_DAL.Reason);
                insert_cmd.Parameters.AddWithValue("@WEF", Convert.ToDateTime(entry_DAL.WEF).ToString());
                insert_cmd.Parameters.AddWithValue("@CURRENTSBU",  entry_DAL.CurrentBU);
                insert_cmd.Parameters.AddWithValue("@NEWSBU",  entry_DAL.NewBU);
                insert_cmd.Parameters.AddWithValue("@CURRENTBU",  entry_DAL.CurrentSBU);
                insert_cmd.Parameters.AddWithValue("@NEWBU",  entry_DAL.NewSBU);
                insert_cmd.Parameters.AddWithValue("@CURRENTHORIZONTAL",  entry_DAL.CurrentHorizontal);
                insert_cmd.Parameters.AddWithValue("@NEWHORIZONTAL",  entry_DAL.NewHorizontal);
                insert_cmd.Parameters.AddWithValue("@CURRENTORG",  entry_DAL.CurrentOrg);
                insert_cmd.Parameters.AddWithValue("@NEWORG",  entry_DAL.NewOrg);
                insert_cmd.Parameters.AddWithValue("@CURRENTCOST",  entry_DAL.CurrentCost);
                insert_cmd.Parameters.AddWithValue("@NEWCOST",  entry_DAL.NewCost);
                insert_cmd.Parameters.AddWithValue("@CURRENTPERSONAL",  entry_DAL.CurrentPersonal);
                insert_cmd.Parameters.AddWithValue("@NEWPERSONAL",  entry_DAL.NewPersonal);
                insert_cmd.Parameters.AddWithValue("@CURRENTSUBAREA",  entry_DAL.CurrentSubArea);
                insert_cmd.Parameters.AddWithValue("@NEWSUBAREA",  entry_DAL.NewSubArea);
                insert_cmd.Parameters.AddWithValue("@CURRENTGRADE",  entry_DAL.CurrentGrade);
                insert_cmd.Parameters.AddWithValue("@NEWGRADE",  entry_DAL.NewGrade);
                insert_cmd.Parameters.AddWithValue("@CURRENTSUPPERID",  Convert.ToInt32(entry_DAL.CurrentSuperId));
                insert_cmd.Parameters.AddWithValue("@NEWSUPPERID",  Convert.ToInt32(entry_DAL.NewSuperId));
                insert_cmd.Parameters.AddWithValue("@SUBMMITEDCOMMENTS",  entry_DAL.SubmittedComment);
                insert_cmd.Parameters.AddWithValue("@SUBMITTEDBY",  Convert.ToInt32(entry_DAL.SubmittedBy));
                insert_cmd.Parameters.AddWithValue("@SUBMITTEDFROMIP",  DBNull.Value);
                insert_cmd.Parameters.AddWithValue("@STATUS",  "S");
                insert_cmd.Parameters.AddWithValue("@SUBMITTEDDATE", System.DateTime.Now.ToString("yyyy-MM-dd H:mm:ss.fff"));
                insert_cmd.Parameters.AddWithValue("@CURRENTET_PLACE",  entry_DAL.CurrBLocation);
                insert_cmd.Parameters.AddWithValue("@NEWET_PLACE",  entry_DAL.NewBLocation);
                insert_cmd.Parameters.AddWithValue("@REPORTING_TYPE",  'O');
                insert_cmd.Parameters.AddWithValue("@CUR_CENTER_DEPLOYMENT",  entry_DAL.CurrCDeploy);
                insert_cmd.Parameters.AddWithValue("@NEW_CENTER_DEPLOYMENT", entry_DAL.NewCDeploy);

                logger.Info("Inserting Details of SCT UpdateInput Entity");

                QueryLog.CmdInfo(insert_cmd);

                //SqlDataReader dr;
                int rowsAffected = insert_cmd.ExecuteNonQuery();
                //if (dr.HasRows)
                if (rowsAffected == 1)
                {
                    //dr.Read();
                    //if (dr["Return Value"].Equals(0))
                    //{
                        //dr.Close();
                        Trans.Commit();
                        result.StatusFlag = 0;
                        result.Message = SCT_Constants.Success;

                        logger.Info("Operation : Insert operation executed successfully");
                }
                else
                {
                    //dr.Close();
                    Trans.Rollback("InsertTransaction");

                    logger.Debug("Transaction Rollback Executed");

                    result.StatusFlag = 1;
                    result.Message = SCT_Constants.Error;

                    logger.Error("Operation : Insert operation Failed");
                }

                return result;
            }
            catch (SqlException dbEx)
            {
                logger.Fatal("SQL Exception Occured At SCT_DAL - updatePurchaseRequest_DAL  : ");
                logger.Error("Exception Code : " + dbEx.Number.ToString());
                logger.Error("Exception Description : " + dbEx.Message.ToString());
                logger.Error("Error : updateSCEmployeeDetails_DAL Stop");
                try
                {
                    logger.Debug("Transaction Rollback Executed");
                    Trans.Rollback("InsertTransaction");
                }
                catch (Exception ex2)
                {
                    logger.Error("Tranasction Rollback Failed : " + ex2.Message.ToString());
                    //throw ex2;
                }
                throw dbEx;
            }
            catch (Exception ex)
            {
                logger.Fatal("Exception Occured At SCT_DAL - updateSCEmployeeDetails_DAL  : " + ex.Message.ToString());
                logger.Error("Method : updateSCEmployeeDetails_DAL Stop");

                try
                {
                    logger.Debug("Transaction Rollback Executed");
                    Trans.Rollback("InsertTransaction");
                }
                catch (Exception ex2)
                {
                    logger.Error("Transaction Rollback Failed : "+ex2.Message.ToString());
                    //throw ex2;
                }
                //throw new myCustomException(32, ex.Message);
                throw ex;
            }
            finally
            {
                logger.Debug("Connection Status Closed ");

                conn.Dispose();
            }
        }
Exemple #2
0
        /// <summary>
        /// This Method validates the input parameters for the updatePurchaseRequest function
        /// </summary>
        /// <param name="entry_BAL"></param>
        /// <returns></returns>
        /// <history>
        ///     Hari haran      08/05/2012      created
        /// </history>
        public SCT_UpdateOutputEntity updateSCEmployeeDetails_BAL(SCT_UpdateInputEntity entry_BAL)
        {
            try
            {
                logger.Info("Method : updateSCEmployeeDetails_BAL Start");
                logger.Debug("Method : updateSCEmployeeDetails_BAL RequestId value : " + entry_BAL.EmpNo.ToString());

                SCT_UpdateOutputEntity errRes = new SCT_UpdateOutputEntity();
                errRes.StatusFlag = 1;
                errRes.Message = SCT_Constants.Error;
                int validate_sctParamFlag = 0;

                validate_sctParamFlag = validate_sctParam(entry_BAL);

                logger.Debug("SCT Input parameter validation flag value(success = 0/failure = 1)  : " + validate_sctParamFlag.ToString());

                if (validate_sctParamFlag == 1)
                {
                    logger.Debug("Error in input parameter values");
                    logger.Debug("ErrorCode = " + errRes.StatusFlag.ToString());
                    logger.Debug("ErrorMessage = " + errRes.Message);
                    logger.Error("Method : updateSCEmployeeDetails_BAL Stop");

                    return errRes;
                }
                else
                {
                    SCT_DAL updateSCT_DAL = new SCT_DAL();
                    return (updateSCT_DAL.updateSCEmployeeDetails_DAL(entry_BAL));
                }
            }
            catch (SqlException dbEx)
            {
                logger.Fatal("Exception  At BAL - updateSCEmployeeDetails_BAL  : " + dbEx.Message.ToString());
                logger.Error("Method : updateSCEmployeeDetails_BAL Stop");

                throw dbEx;
            }
            catch (Exception ex)
            {
                logger.Fatal("Exception  At BAL - updateSCEmployeeDetails_BAL  : " + ex.Message.ToString());
                logger.Error("Method : updateSCEmployeeDetails_BAL Stop");

                throw ex;
            }
        }
Exemple #3
0
    public SCT_UpdateOutputEntity updateSCEmployeeDetails([XmlElement("SCT_Input")] SCT_UpdateInputEntity SCT_Entry)
    {
        logger.Info("Method : updateSCEmployeeDetails Start");
        logger.Debug("EmployeeID value : " + SCT_Entry.EmpNo.ToString());

        SCT_UpdateOutputEntity result = new SCT_UpdateOutputEntity();
        try
        {
            SCTInterface updateSCT_IS = new SCTInterface();
            result = updateSCT_IS.updateSCEmployeeDetails_SI(SCT_Entry);

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

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

            result.StatusFlag = 1;
            string expCode = ExpType(ex);
            result.Message = SCT_Constants.cnfgErrMessages[expCode];

            logger.Debug("Return object Error : ErrorCode = " + result.StatusFlag.ToString());
            logger.Debug("Return object Error : ErrorMessage = " + result.Message);
            logger.Error("Method : updateSCEmployeeDetails Stop");

            return result;

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

            result.StatusFlag = 1;
            result.Message = SCT_Constants.Error;

            logger.Debug("Return object Error : ErrorCode = " + result.StatusFlag.ToString());
            logger.Debug("Return object Error : ErrorMessage = " + result.Message);
            logger.Error("Method : updateSCEmployeeDetails Stop");

            return result;
        }
    }