Пример #1
0
 public Customer Parse(CustomerCommand command)
 {
     return(new Customer()
     {
         TradingName = command.TradingName
     });
 }
Пример #2
0
        protected override CustomerCommand CreateCommand(DataCommandConfig commandConfig)
        {
            //1.创建 Connection 对象【需要从连接池中获取连接对象,此处后续优化】
            //string strConn = ConfigurationManager.AppSettings["ConnectionString"];

            var dbConfig = DataManager.DatabaseDictionary[commandConfig.DataSourceID];
            string strConn = dbConfig.ConnectionString;

            MySqlConnection dbConnection = new MySqlConnection(strConn);

            //2.创建 Command 对象
            MySqlCommand command = new MySqlCommand(commandConfig.CommandText, dbConnection);
            command.CommandType = CommandType.Text;

            //3.填充参数列表
            foreach (ParameterConfig param in commandConfig.Parameters)
            {
                MySqlParameter parameter = command.CreateParameter();
                parameter.ParameterName = param.Name;
                parameter.DbType = param.DBType;
                parameter.Size = param.Size == 0 ? 4 : param.Size;
                parameter.Direction = ParameterDirection.Input; //默认是输入参数
                command.Parameters.Add(parameter);
            }
            CustomerCommand customerCmd = new CustomerCommand(command, DataBaseType.MySQL);
            return customerCmd;
        }
        protected static CustomerDocument GetCustomerFromErpNext(string name)
        {
            var receiver         = new CustomerCommand(name, $"{GetCustomerResourceServerAddress()}");
            var customerDocument = receiver.Execute();

            return(customerDocument.Data.Message);
        }
        private CustomerDocument GetCustomerDetails(string customerName)
        {
            var receiver = new CustomerCommand(customerName, $"{GetResourceServerAddress()}");
            var document = receiver.Execute();

            return(document.Data.Message);
        }
Пример #5
0
        public List <ReportDataModel> FetchAttendanceData(int churchId, DateTime startDate, DateTime endDate, List <int> mnList, List <int> gtList)
        {
            CustomerCommand command = _dataManager.CreateCustomerCommand("Dashboard.FetchAttendanceData");

            command.SetParameterValue("@ChurchId", churchId);
            command.SetParameterValue("@StartDate", startDate);
            command.SetParameterValue("@EndDate", endDate);

            string whereStr_mn = "AND widgetItem.[UserWidgetItemID] IN (-999)";
            string whereStr_gt = "AND widgetItem.[UserWidgetItemID] IN (-999)";

            if (mnList != null && mnList.Count > 0)
            {
                whereStr_mn = string.Format("AND widgetItem.[UserWidgetItemID] IN ({0})", string.Join <int>(",", mnList));
            }
            if (mnList != null && mnList.Count > 0)
            {
                whereStr_gt = string.Format("AND widgetItem.[UserWidgetItemID] IN ({0})", string.Join <int>(",", gtList));
            }

            command.CommandText = command.CommandText.Replace("#WhereStr_mn#", whereStr_mn);
            command.CommandText = command.CommandText.Replace("#WhereStr_gt#", whereStr_gt);

            return(command.ExecuteCommandToEntitys <ReportDataModel>());
        }
Пример #6
0
        public ChurchModel FetchChurchInfomation(int churchId)
        {
            CustomerCommand command = _dataManager.CreateCustomerCommand("Church.FetchChurchInfomation");

            command.SetParameterValue("@ChurchId", churchId);

            ChurchModel church = command.ExecuteCommandToEntity <ChurchModel>();

            return(church);
        }
Пример #7
0
        public static void Send(CustomerCommand CustomerCommand)
        {
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(_ConnectionString);
            CloudQueueClient    queueClient    = storageAccount.CreateCloudQueueClient();
            CloudQueue          queue          = queueClient.GetQueueReference(CustomerCommand.QueueName);

            queue.CreateIfNotExistsAsync().Wait();

            CloudQueueMessage message = new CloudQueueMessage(Newtonsoft.Json.JsonConvert.SerializeObject(CustomerCommand));

            queue.AddMessageAsync(message);
        }
Пример #8
0
 public IActionResult Post([FromBody] CustomerCommand command)
 {
     try
     {
         _customerAppService.Add_a_new_Customer(command);
         return(Ok("Customer added with success."));
     }
     catch (System.Exception ex)
     {
         return(Problem(ex.Message));
     }
 }
 private void OnCmdConnect()
 {
     try
     {
         LogEntryView.ConnectionTest();
         IsDbConnect = true;
         AddCommand.RaiseCanExecuteChanged();
         LoadCommand.RaiseCanExecuteChanged();
         ConnectCommand.RaiseCanExecuteChanged();
         CustomerCommand.RaiseCanExecuteChanged();
         LocationTreeCommand.RaiseCanExecuteChanged();
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             ex.Message);
     }
 }
Пример #10
0
        public List <ReportDataModel> FetchAttributeData(int churchId, DateTime startDate, DateTime endDate, List <int> widgetItemIds)
        {
            CustomerCommand command = _dataManager.CreateCustomerCommand("Dashboard.FetchAttributeData");

            command.SetParameterValue("@ChurchId", churchId);
            command.SetParameterValue("@StartDate", startDate);
            command.SetParameterValue("@EndDate", endDate);

            string whereStr = "AND widgetItem.[UserWidgetItemID] IN (-999)";

            if (widgetItemIds != null && widgetItemIds.Count > 0)
            {
                whereStr = string.Format("AND widgetItem.[UserWidgetItemID] IN ({0})", string.Join <int>(",", widgetItemIds));
            }
            command.CommandText = command.CommandText.Replace("#WhereStr#", whereStr);

            return(command.ExecuteCommandToEntitys <ReportDataModel>());
        }
Пример #11
0
        public List <string> SendContentMethod(List <string> strList, string targetId, CustomerCommand command, string message = null, string fromId = null)
        {
            SendContent CtoC = new SendContent()
            {
                Target  = targetId,
                Message = PublicMethod.JsonSerialize <ReceiveModel>(new ReceiveModel()
                {
                    Command = command,
                    Message = message,
                    FromId  = fromId
                }),
                From = Connector.HubToken
            };

            strList.Add(PublicMethod.JsonSerialize <SendContent>(CtoC));
            return(strList);
        }
Пример #12
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            NetworkCredentials.Instance().NetworkDomain   = Properties.Settings.Default.networkdomain;
            NetworkCredentials.Instance().NetworkUsername = Properties.Settings.Default.networkusername;
            NetworkCredentials.Instance().NetworkPassord  = Properties.Settings.Default.networkpassword;
            //NetworkFileSystemUtilsProxy p = new NetworkFileSystemUtilsProxy();
            //p.UncFileExist(@"\\DESKTOP-E9KNOCC\ciccio\ciccio.txt");

            //initialize skinning properties
            barManager.ForceInitialize();
            MyBarLocalizer.Active = new MyBarLocalizer();
            SkinHelper.InitSkinPopupMenu(mPaintStyle);


            //initialize navigator
            _navUtil = new NavigationUtils(splitContainerControl.Panel2, this);

            //renders startup controls
            if (_customerId == "")
            {
                _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
            }
            else
            {
                try
                {
                    IOpenCommand cmd = new CustomerCommand(this);
                    Hashtable    h   = new Hashtable();
                    h.Add("Id", _customerId);
                    cmd.Execute(h);
                    HistoryOfCommands.Instance().AddCommandToHistory(cmd);
                    MemoryHelper.ReduceMemory();
                }
                catch (Exception ex)
                {
                    ErrorHandler.Show(ex);
                    _navUtil.NavigateToStartupControl(Properties.Settings.Default.Main_StartCommand);
                }
            }

            //sets the caption text
            this.Text = "Gestionale appuntamenti - " + Properties.Settings.Default.Main_AppName;

            //sets the name of the current logged user
            string nome = ((User)(SecurityManager.Instance.CurrentUser)).Username;

            sItem.Caption = string.Format("Benvenuto: {0}!", nome);

            if (DataAccessServices.Instance().PersistenceFacade.DBType == DB.DBType.Access)
            {
                // barRipristina.Visibility = BarItemVisibility.Always;ù
                barButtonbackup.Visibility = BarItemVisibility.Always;
                UpdateLastBackInfo();
                barBack.Visibility = BarItemVisibility.Always;
            }
            else
            {
                //barRipristina.Visibility = BarItemVisibility.Never;
                barButtonbackup.Visibility = BarItemVisibility.Never;
                barBack.Visibility         = BarItemVisibility.Never;
            }



            //sets initial view
            splitContainerControl.Collapsed = Properties.Settings.Default.Main_PanelCollapsed;
            administration.Visible          = !Properties.Settings.Default.Main_ShowOnlyAgendaFunctions;
        }
        public async Task <IActionResult> InsertCustomerAsync([FromBody] CustomerCommand customerCommand)
        {
            await mediator.Send(customerCommand);

            return(NoContent());
        }
        public async Task <IActionResult> PostAsync(CustomerCommand data)
        {
            var result = await _mediatr.Send(data);

            return(Ok(result));
        }