Exemplo n.º 1
0
        public void UpdateRiskManagementImport(ModelRiskManagementImport pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = "UPDATE RISK_IMPORT SET " +
                                "RISK_SCORE = '{0}'," +
                                "INTERNAL_CORROSION = '{1}'," +
                                "EXTERNAL_CORROSION = '{2}'," +
                                "THIRD_PARTY_INTERFERENCE = '{3}'," +
                                "LOSS_OF_GROUND_SUPPORT = '{4}'," +
                                "WHERE 1=1 " +
                                "AND RC = {5} " +
                                "AND YEAR = {6}";

            strCommand = string.Format(
                strCommand,
                pModel.RISK_SCORE,
                pModel.INTERNAL_CORROSION,
                pModel.EXTERNAL_CORROSION,
                pModel.THIRD_PARTY_INTERFERENCE,
                pModel.LOSS_OF_GROUND_SUPPORT,
                pModel.RC,
                pModel.YEAR);
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 2
0
        public void InsertPipelineArchive(ModelPipelineArchive pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = @"INSERT INTO PTTOUR.PIPELINE_ARCHIVE (RC_NAME, MONTH, YEAR, UPLOAD_DATE, UPLOAD_BY, REGION,FLAG_ID, VELOCITY ,FLOW, DIAMETER, LENGTH,EFFICIENCY, ROUGHNESS, LOAD,OUTSIDE_DIAMETER, WALL_THICKNESS, SERVICE_STATE) 
            VALUES ( '{0}',{1} , {2} , sysdate , '{3}' , {4} , {5} , {6} , {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, '{15}')";

            strCommand = string.Format(strCommand,
                                       pModel.RC_NAME.Trim().Replace("'", "''"),
                                       pModel.MONTH,
                                       pModel.YEAR,
                                       pModel.UPLOAD_BY.Trim().Replace("'", "''"),
                                       pModel.REGION.Trim().Replace("'", "''"),
                                       pModel.FLAG_ID,
                                       pModel.VELOCITY,
                                       pModel.FLOW,
                                       pModel.DIAMETER,
                                       pModel.LENGTH,
                                       pModel.EFFICIENCY,
                                       pModel.ROUGHNESS,
                                       pModel.LOAD,
                                       pModel.OUTSIDE_DIAMETER,
                                       pModel.WALL_THICKNESS,
                                       pModel.SERVICE_STATE.Replace("'", "''"));
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 3
0
        public void InsertRiskManagementImport(ModelRiskManagementImport pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = @"INSERT INTO RISK_IMPORT
                (
                    REGION,
                    RC,
                    RISK_SCORE,
                    INTERNAL_CORROSION,
                    EXTERNAL_CORROSION,
                    THIRD_PARTY_INTERFERENCE,
                    LOSS_OF_GROUND_SUPPORT,
                    YEAR
                ) 
                VALUES ( '{0}' ,{1} ,{2} ,{3} ,{4} ,{5} ,{6} , {7})";

            strCommand = string.Format(
                strCommand,
                pModel.REGION,
                pModel.RC,
                pModel.RISK_SCORE,
                pModel.INTERNAL_CORROSION,
                pModel.EXTERNAL_CORROSION,
                pModel.THIRD_PARTY_INTERFERENCE,
                pModel.LOSS_OF_GROUND_SUPPORT,
                pModel.YEAR
                );
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 4
0
        public void UpdatePipelineArchive(ModelPipelineArchive pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = @"UPDATE PIPELINE_ARCHIVE SET    
       RC_NAME     = '{0}',       
       UPLOAD_DATE = sysdate,
       UPLOAD_BY   = '{1}',
       REGION      = '{2}',
       FLOW     = {3},
       VELOCITY    = {4},
        DIAMETER = {8},
        LENGTH = {9},
        EFFICIENCY = {10},
        ROUGHNESS = {11},
        LOAD = {12},
        OUTSIDE_DIAMETER = {13},
        WALL_THICKNESS = {14},
        SERVICE_STATE = '{15}'
WHERE  1=1
	AND PIPELINE_ID = {5}	
	AND    MONTH       = {6}
	AND    YEAR        = {7}"    ;

            strCommand = string.Format(strCommand,
                                       pModel.RC_NAME.Trim().Replace("'", "''"),

                                       pModel.UPLOAD_BY.Trim().Replace("'", "''"),
                                       pModel.REGION.Trim().Replace("'", "''"),
                                       pModel.FLOW,
                                       pModel.VELOCITY,
                                       pModel.PIPELINE_ID,
                                       pModel.MONTH,
                                       pModel.YEAR,
                                       pModel.DIAMETER,
                                       pModel.LENGTH,
                                       pModel.EFFICIENCY,
                                       pModel.ROUGHNESS,
                                       pModel.LOAD,
                                       pModel.OUTSIDE_DIAMETER,
                                       pModel.WALL_THICKNESS,
                                       pModel.SERVICE_STATE.Replace("'", "''"));
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 5
0
        public void UpdateThreshold(Models.ViewModel.ModelThresholdItem pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = string.Empty;

            if (pModel.ThresholdType == Models.ViewModel.EnumThresholdType.GateStation)
            {
                strCommand = @"UPDATE GATESTATION_THRESHOLD
SET 
       MINVAL                = {0},
       MAXVAL                = {1},
       UPDATED_DATE          = sysdate,
       UPDATED_BY            = '{2}'
WHERE  GATE_THRESHOLD_ID = {3}";
            }
            else if (pModel.ThresholdType == Models.ViewModel.EnumThresholdType.PipeLine)
            {
                strCommand = @"UPDATE PIPELINE_THRESHOLD
SET
       MINVAL                = {0},
       MAXVAL                = {1},
       UPDATED_DATE          = sysdate,
       UPDATED_BY            = '{2}'
WHERE  PIPELINE_THRESHOLD_ID = {3}";
            }
            if (string.IsNullOrEmpty(strCommand))
            {
                return;
            }
            strCommand = string.Format(strCommand,
                                       pModel.MinValue,
                                       pModel.MaxValue,
                                       pModel.UPDATED_BY.Trim().Replace("'", "''"),
                                       pModel.ThresholdId);

            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 6
0
        public void InsertGateImport(ModelGateStationImport pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = "INSERT INTO GATESTATION_IMPORT ( GATE_NAME,PRESSURE,FLOW, MONTH, YEAR,UPLOAD_DATE, UPLOAD_BY,REGION) VALUES ('{0}'," + (pModel.PRESSURE != null ? pModel.PRESSURE.ToString() : "NULL") + "," + (pModel.FLOW != null ? pModel.FLOW.ToString() : "NULL") + ",{1},{2},SYSDATE,'{3}', NULL)";

            strCommand = string.Format(strCommand,
                                       pModel.GATE_NAME.Trim().Replace("'", "''"),
                                       pModel.MONTH,
                                       pModel.YEAR,
                                       pModel.UPLOAD_BY.Trim().Replace("'", "''"));
            //pModel.REGION.Trim().Replace("'", "''"));
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 7
0
        public void InsertGateArchive(ModelGateStationArchive pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = "INSERT INTO PTTOUR.GATESTATION_ARCHIVE (GATE_NAME, FLOW,MONTH,YEAR, UPLOAD_DATE,UPLOAD_BY, REGION, FLAG_ID , PRESSURE) VALUES ('{0}'," + (pModel.FLOW != null ? pModel.FLOW.ToString() : "NULL") + ",{1},{2},sysdate,'{3}',NULL,{4} , " + (pModel.PRESSURE != null ? pModel.PRESSURE.ToString() : "NULL") + " )";

            strCommand = string.Format(strCommand,
                                       pModel.GATE_NAME.Trim().Replace("'", "''"),
                                       pModel.MONTH,
                                       pModel.YEAR,
                                       pModel.UPLOAD_BY.Trim().Replace("'", "''"),
                                       //pModel.REGION.Trim().Replace("'", "''"),
                                       pModel.FLAG_ID);
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 8
0
        public void UpdateGateArchive(ModelGateStationArchive pModel)
        {
            if (pModel == null)
            {
                return;
            }
            string strCommand = "UPDATE GATESTATION_ARCHIVE SET GATE_NAME = '{0}',FLOW = " + (pModel.FLOW != null ? pModel.FLOW.ToString() : "NULL") + ",UPLOAD_DATE = sysdate,UPLOAD_BY = '{1}',REGION = NULL,PRESSURE = " + (pModel.PRESSURE != null ? pModel.PRESSURE.ToString() : "NULL") + " WHERE 1=1 AND GATE_ID = {2} AND MONTH = {3} AND YEAR = {4}";

            strCommand = string.Format(strCommand,
                                       pModel.GATE_NAME.Trim().Replace("'", "''"),
                                       pModel.UPLOAD_BY.Trim().Replace("'", "''"),
                                       //pModel.REGION,
                                       pModel.GATE_ID,
                                       pModel.MONTH,
                                       pModel.YEAR);
            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 9
0
        public void InsertRiskFile(string username, string rc_name, int year, string file_name)
        {
            string strCommand = string.Format(@"INSERT INTO RISK_FILE
            (
                RC_NAME,
                YEAR,
                FILE_NAME,
                UPLOADED_AT,
                UPLOADED_BY
            ) VALUES ( '{0}', {1}, '{2}', Sysdate, '{3}')",
                                              rc_name,
                                              year,
                                              file_name,
                                              username
                                              );

            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 10
0
        public void UpdateAcceptanceCriteria(ModelAcceptanceCriteria model)
        {
            if (model == null)
            {
                return;
            }

            string strCommand = "UPDATE RISK_THRESHOLD SET " +
                                "RISK_CRITERIA = '{0}'," +
                                "UPDATE_DATE = sysdate," +
                                "UPDATE_BY = '{1}'";

            strCommand = string.Format(
                strCommand,
                model.RISK_CRITERIA,
                model.UPDATE_BY);

            var dal = new DAL.DAL();

            dal.ExecuteNonQuery(strCommand);
            dal = null;
        }
Exemplo n.º 11
0
        }//ResetPassword

        public ActionResult ChangePassword(string NewPassword, string OldPassword, string ConfirmNewPassword, Models.User user)
        {
            string ChangePassText = "Password changed successfully";

            byte[] results;
            if (NewPassword == "" || OldPassword == "" || ConfirmNewPassword == "")
            {
                ChangePassText = "Please complete the data";
            }
            else
            {
                string encryptedPassword;

                UTF8Encoding             utf8 = new UTF8Encoding();
                MD5CryptoServiceProvider md5  = new MD5CryptoServiceProvider();
                byte[] deskey = md5.ComputeHash(utf8.GetBytes(OldPassword));
                TripleDESCryptoServiceProvider desalg = new TripleDESCryptoServiceProvider();
                desalg.Key     = deskey;//to  pass encode key
                desalg.Mode    = CipherMode.ECB;
                desalg.Padding = PaddingMode.PKCS7;
                byte[] encrypt_data = utf8.GetBytes(OldPassword);
                try
                {
                    ICryptoTransform encryptor = desalg.CreateEncryptor();
                    results           = encryptor.TransformFinalBlock(encrypt_data, 0, encrypt_data.Length);
                    encryptedPassword = Convert.ToBase64String(results);
                }
                finally
                {
                    desalg.Clear();
                    md5.Clear();
                }
                if (encryptedPassword == userConTR.Password)
                {
                    if (NewPassword == ConfirmNewPassword)
                    {
                        string                   username = User.Identity.Name;
                        byte[]                   resultsChange;
                        string                   encryptedChangePassword;
                        UTF8Encoding             utf8_   = new UTF8Encoding();
                        MD5CryptoServiceProvider md5_    = new MD5CryptoServiceProvider();
                        byte[]                   deskey_ = md5_.ComputeHash(utf8_.GetBytes(ConfirmNewPassword));

                        TripleDESCryptoServiceProvider desalg_ = new TripleDESCryptoServiceProvider();
                        desalg_.Key     = deskey_;//to  pass encode key
                        desalg_.Mode    = CipherMode.ECB;
                        desalg_.Padding = PaddingMode.PKCS7;
                        byte[] encrypt_data_ = utf8_.GetBytes(ConfirmNewPassword);

                        try
                        {
                            ICryptoTransform encryptor_ = desalg_.CreateEncryptor();
                            resultsChange           = encryptor_.TransformFinalBlock(encrypt_data_, 0, encrypt_data_.Length);
                            encryptedChangePassword = Convert.ToBase64String(resultsChange);
                        }
                        finally
                        {
                            desalg_.Clear();
                            md5_.Clear();
                        }
                        var dal = new DAL.DAL();
                        //var dal2 = new DAL.DAL();
                        string CommandAuth   = "UPDATE USERS_AUTH SET PASSWORD = '******', UPDATE_DATE = Sysdate, UPDATE_BY = '" + username + "' WHERE EMPLOYEE_ID ='" + userConTR.Username + "'";
                        string CommandStatus = "UPDATE USERS_AUTH_STATUS SET PASSDATE = Sysdate WHERE EMPLOYEE_ID ='" + userConTR.Username + "'";
                        dal.ExecuteNonQuery(CommandAuth);
                        dal.ExecuteNonQuery(CommandStatus);
                        //var con = dal.GetConnection();
                        //var con2 = dal2.GetConnection();
                        //con.Open();
                        //con2.Open();

                        //dal.GetCommand(CommandAuth, con).ExecuteNonQuery();
                        //dal.GetCommand(CommandStatus, con2).ExecuteNonQuery();
                        //con.Close();
                        //con2.Close();
                        //con.Dispose();
                        //con2.Dispose();
                    }
                    else
                    {
                        ChangePassText = "New Password dose not match Confirm Password";
                    }
                }
                else
                {
                    ChangePassText = "Old Password is not valid";
                }
            }//end check empty

            return(Content(ChangePassText));
        }//ChangePassword