コード例 #1
0
ファイル: UIClientList.cs プロジェクト: DR2010/FCM2
        /// Implementing Interface

        /// <summary>
        /// List Companies Sync
        /// </summary>
        public ClientListResponse ClientList(HeaderInfo headerInfo)
        {
            //loadClientListAsync();
            //return;


            var responseClientList = new BUSClient().ClientList(HeaderInfo.Instance);

            if (responseClientList.response.ReturnCode < 0000)
            {
                LogFile.WriteToTodaysLogFile("Error loading client list", HeaderInfo.Instance.UserID, "", "UIClientList.cs");
                return(responseClientList);
            }

            var clientList = responseClientList.clientList;

            try
            {
                clientBindingSource.DataSource = clientList;
            }
            catch (Exception ex)
            {
                LogFile.WriteToTodaysLogFile(
                    "Error binding response. " + ex.ToString(),
                    Utils.UserID,
                    ResponseStatus.MessageCode.Error.FCMERR00009999,
                    "UIClientList.cs");
            }
            return(responseClientList);
        }
コード例 #2
0
 public RepClientExtraInformation(HeaderInfo headerInfo)
 {
     _headerInfo = headerInfo;
 }
コード例 #3
0
        // -----------------------------------------------------
        //    Add new Client
        // -----------------------------------------------------
        public static ResponseStatus Insert(
            HeaderInfo headerInfo,
            ClientExtraInformation clientExtraInfo,
            MySqlConnection connection)
        {
            ResponseStatus response = new ResponseStatus();

            response.ReturnCode = 1;
            response.ReasonCode = 1;
            response.Message    = "Client Added Successfully";

            int _uid = 0;

            int nextUID = GetLastUID() + 1; // 2010100000

            clientExtraInfo.UID = nextUID;
            DateTime _now = DateTime.Today;

            clientExtraInfo.RecordVersion    = 1;
            clientExtraInfo.IsVoid           = "N";
            clientExtraInfo.CreationDateTime = headerInfo.CurrentDateTime;
            clientExtraInfo.UpdateDateTime   = headerInfo.CurrentDateTime;
            clientExtraInfo.UserIdCreatedBy  = headerInfo.UserID;
            clientExtraInfo.UserIdUpdatedBy  = headerInfo.UserID;

            var commandString =
                (
                    "INSERT INTO ClientExtraInformation " +
                    "(" +
                    ClientFieldString() +
                    ")" +
                    " VALUES " +
                    "( @UID     " +
                    ", @FKClientUID    " +
                    ", @DateToEnterOnPolicies    " +
                    ", @ScopeOfServices " +
                    ", @ActionPlanDate " +
                    ", @CertificationTargetDate " +
                    ", @TimeTrading " +
                    ", @RegionsOfOperation " +
                    ", @OperationalMeetingsFrequency " +
                    ", @ProjectMeetingsFrequency " +
                    ", @IsVoid " +
                    ", @RecordVersion " +
                    ", @UpdateDateTime " +
                    ", @UserIdUpdatedBy " +
                    ", @CreationDateTime  " +
                    ", @UserIdCreatedBy ) "
                );



            using (var command = new MySqlCommand(commandString, connection))
            {
                clientExtraInfo.RecordVersion = 1;
                clientExtraInfo.IsVoid        = "N";
                AddSQLParameters(command, MakConstant.SQLAction.CREATE, clientExtraInfo);

                if (connection.State != ConnectionState.Open)
                {
                    connection.Open();
                }

                command.ExecuteNonQuery();
            }

            response.Contents = _uid;

            return(response);
        }
コード例 #4
0
        /// <summary>
        /// Update client details
        /// </summary>
        /// <returns></returns>
        public static ResponseStatus Update(
            HeaderInfo headerInfo,
            ClientExtraInformation clientExtraInfo,
            MySqlConnection connection)
        {
            var response = new ResponseStatus {
                ReturnCode = 1, ReasonCode = 1, Message = "Client Updated Successfully."
            };

            // using (var connection = new MySqlConnection(ConnString.ConnectionString))

            using (connection)
            {
                var commandString = (
                    "UPDATE ClientExtraInformation " +
                    " SET  " +
                    FCMDBFieldName.ClientExtraInformation.ActionPlanDate + " = @" + FCMDBFieldName.ClientExtraInformation.ActionPlanDate + ", " +
                    FCMDBFieldName.ClientExtraInformation.CertificationTargetDate + " = @" + FCMDBFieldName.ClientExtraInformation.CertificationTargetDate + ", " +
                    FCMDBFieldName.ClientExtraInformation.DateToEnterOnPolicies + " = @" + FCMDBFieldName.ClientExtraInformation.DateToEnterOnPolicies + ", " +
                    FCMDBFieldName.ClientExtraInformation.OperationalMeetingsFrequency + " = @" + FCMDBFieldName.ClientExtraInformation.OperationalMeetingsFrequency + ", " +
                    FCMDBFieldName.ClientExtraInformation.ProjectMeetingsFrequency + " = @" + FCMDBFieldName.ClientExtraInformation.ProjectMeetingsFrequency + ", " +
                    FCMDBFieldName.ClientExtraInformation.RecordVersion + " = @" + FCMDBFieldName.ClientExtraInformation.RecordVersion + ", " +
                    FCMDBFieldName.ClientExtraInformation.RegionsOfOperation + " = @" + FCMDBFieldName.ClientExtraInformation.RegionsOfOperation + ", " +
                    FCMDBFieldName.ClientExtraInformation.ScopeOfServices + " = @" + FCMDBFieldName.ClientExtraInformation.ScopeOfServices + ", " +
                    FCMDBFieldName.ClientExtraInformation.TimeTrading + " = @" + FCMDBFieldName.ClientExtraInformation.TimeTrading + ", " +
                    FCMDBFieldName.ClientExtraInformation.IsVoid + " = @" + FCMDBFieldName.ClientExtraInformation.IsVoid + ", " +
                    FCMDBFieldName.ClientExtraInformation.UpdateDateTime + " = @" + FCMDBFieldName.ClientExtraInformation.UpdateDateTime + ", " +
                    FCMDBFieldName.ClientExtraInformation.UserIdUpdatedBy + " = @" + FCMDBFieldName.ClientExtraInformation.UserIdUpdatedBy +
                    "    WHERE FKClientUID = @FKClientUID "
                    );


                clientExtraInfo.RecordVersion++;
                clientExtraInfo.UpdateDateTime  = DateTime.Now;
                clientExtraInfo.UserIdUpdatedBy = headerInfo.UserID;
                clientExtraInfo.IsVoid          = "N";

                using (var command = new MySqlCommand(
                           cmdText: commandString,
                           connection: connection))
                {
                    AddSQLParameters(command, MakConstant.SQLAction.UPDATE, clientExtraInfo);

                    try
                    {
                        if (connection.State != ConnectionState.Open)
                        {
                            connection.Open();
                        }

                        command.ExecuteNonQuery();
                    }
                    catch (Exception ex)
                    {
                        LogFile.WriteToTodaysLogFile(ex.ToString(), headerInfo.UserID);

                        response.ReturnCode = -0020;
                        response.ReasonCode = 0001;
                        response.Message    = "Error saving Client Extra Information. " + ex.ToString();
                        return(response);
                    }
                }
            }
            return(response);
        }