コード例 #1
0
        private static void UpdateShareHolder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, Guid?ShareHolderID, string ShareHolderName, double?Percentage, int BumiShare, Guid?CountryRegionID)
        {
            using (SqlCommand com = new SqlCommand("", Connection))
            {
                System.Text.StringBuilder sql = new System.Text.StringBuilder();
                sql.AppendLine("UPDATE ShareHolder SET");
                sql.AppendLine("ShareHolderName = @ShareHolderName,");
                sql.AppendLine("Percentage = @Percentage,");
                sql.AppendLine("BumiShare = @BumiShare,");
                sql.AppendLine("Status = 1,");
                sql.AppendLine("CountryRegionID = @CountryRegionID,");
                sql.AppendLine("ModifiedBy = @ModifiedBy,");
                sql.AppendLine("ModifiedByName = @ModifiedByName,");
                sql.AppendLine("ModifiedDate = GETDATE()");
                sql.AppendLine("WHERE ShareHolderID = @ShareHolderID");

                com.CommandText    = sql.ToString();
                com.CommandType    = CommandType.Text;
                com.Connection     = Connection;
                com.Transaction    = Transaction;
                com.CommandTimeout = int.MaxValue;

                com.Parameters.Add(new SqlParameter("@ShareHolderID", ShareHolderID));
                com.Parameters.Add(new SqlParameter("@ShareHolderName", ShareHolderName));
                com.Parameters.Add(new SqlParameter("@Percentage", Percentage));
                com.Parameters.Add(new SqlParameter("@BumiShare", BumiShare));
                com.Parameters.Add(new SqlParameter("@CountryRegionID", CountryRegionID));
                com.Parameters.Add(new SqlParameter("@ModifiedBy", SyncHelper.AdminID));
                com.Parameters.Add(new SqlParameter("@ModifiedByName", SyncHelper.AdminName));

                try
                {
                    //con.Open(
                    com.ExecuteNonQuery();

                    //Company Change Log - MSC History
                    BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog();
                    DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, ShareHolderID.Value);
                    alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID.Value, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName);
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
        }
コード例 #2
0
        private static void DeleteShareholder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, string ShareHolderName)
        {
            SqlCommand com = new SqlCommand();

            System.Text.StringBuilder sql = new System.Text.StringBuilder();

            BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog();
            Guid    ShareHolderID  = Guid.NewGuid();
            DataRow currentLogData = alMgr.SelectAccountForLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID);

            sql.AppendLine("DELETE FROM ShareHolder ");
            sql.AppendLine("WHERE AccountID = @AccountID ");
            sql.AppendLine(" AND  ShareholderName = @ShareholderName ");
            com.Parameters.Add(new SqlParameter("@AccountID", AccountID));
            com.Parameters.Add(new SqlParameter("@ShareholderName", ShareHolderName));
            com.CommandText    = sql.ToString();
            com.CommandType    = CommandType.Text;
            com.Connection     = Connection;
            com.Transaction    = Transaction;
            com.CommandTimeout = int.MaxValue;

            try
            {
                //con.Open()
                com.ExecuteNonQuery();

                //Company Change Log - Shareholder
                DataRow newLogData = alMgr.SelectAccountForLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID);
                if (currentLogData != null && newLogData != null)
                {
                    alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID, AccountID.Value, currentLogData, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName);
                }
            }
            catch (Exception ex)
            {
                throw;
                //Finally
                //	con.Close()
            }
        }
コード例 #3
0
        public static void CreateShareHolder(SqlConnection Connection, SqlTransaction Transaction, Guid?AccountID, string ShareHolderName, double?Percentage, int BumiShare, Guid?CountryRegionID, DateTime DateNow)
        {
            using (SqlCommand com = new SqlCommand("", Connection))
            {
                System.Text.StringBuilder sql = new System.Text.StringBuilder();
                //sql.AppendLine("DELETE FROM ShareHolder")
                //sql.AppendLine("WHERE AccountID = @AccountID ")
                //sql.AppendLine("AND ModifiedDate <> @DateNow ")
                sql.AppendLine("INSERT INTO ShareHolder (");
                sql.AppendLine("ShareHolderID, ");
                sql.AppendLine("AccountID,");
                sql.AppendLine("ShareHolderName,");
                sql.AppendLine("Percentage,");
                sql.AppendLine("BumiShare,");
                sql.AppendLine("CountryRegionID,");
                sql.AppendLine("CreatedBy,");
                sql.AppendLine("CreatedByName,");
                sql.AppendLine("CreatedDate,");
                sql.AppendLine("ModifiedBy,");
                sql.AppendLine("ModifiedByName,");
                sql.AppendLine("ModifiedDate,");
                sql.AppendLine("Status");
                sql.AppendLine(")");
                sql.AppendLine("VALUES (");
                sql.AppendLine("@ShareHolderID, ");
                sql.AppendLine("@AccountID,");
                sql.AppendLine("@ShareHolderName,");
                sql.AppendLine("@Percentage,");
                sql.AppendLine("@BumiShare,");
                sql.AppendLine("@CountryRegionID,");
                sql.AppendLine("@CreatedBy,");
                sql.AppendLine("@CreatedByName,");
                sql.AppendLine("@DateNow,");
                sql.AppendLine("@CreatedBy,");
                sql.AppendLine("@CreatedByName,");
                sql.AppendLine("@DateNow,");
                sql.AppendLine("1");
                sql.AppendLine(")");

                com.CommandText    = sql.ToString();
                com.CommandType    = CommandType.Text;
                com.Connection     = Connection;
                com.Transaction    = Transaction;
                com.CommandTimeout = int.MaxValue;

                Guid ShareHolderID = Guid.NewGuid();
                com.Parameters.Add(new SqlParameter("@ShareHolderID", ShareHolderID));
                com.Parameters.Add(new SqlParameter("@AccountID", AccountID));
                com.Parameters.Add(new SqlParameter("@ShareHolderName", ShareHolderName));
                com.Parameters.Add(new SqlParameter("@Percentage", Percentage));
                com.Parameters.Add(new SqlParameter("@BumiShare", BumiShare));
                com.Parameters.Add(new SqlParameter("@DateNow", DateNow));
                com.Parameters.Add(new SqlParameter("@CountryRegionID", CountryRegionID));
                com.Parameters.Add(new SqlParameter("@CreatedBy", SyncHelper.AdminID));
                com.Parameters.Add(new SqlParameter("@CreatedByName", SyncHelper.AdminName));

                try
                {
                    //con.Open()
                    com.ExecuteNonQuery();

                    //Company Change Log - MSC History
                    BOL.AuditLog.Modules.AccountLog alMgr = new BOL.AuditLog.Modules.AccountLog();
                    DataRow newLogData = alMgr.SelectAccountForLog_MSCStatus_Wizard(Connection, Transaction, ShareHolderID);
                    alMgr.CreateAccountLog_Shareholder_Wizard(Connection, Transaction, ShareHolderID, AccountID.Value, null, newLogData, new Guid(SyncHelper.AdminID), SyncHelper.AdminName);
                }
                catch (Exception ex)
                {
                    throw;
                    //Finally
                    //	con.Close()
                }
            }
        }