Ejemplo n.º 1
0
        /// <summary>
        /// 取得客戶名稱清單
        /// </summary>
        /// <returns></returns>
        public IEnumerable <CustomerName> GetCustomerNameList()
        {
            var sqlCmd = "SELECT Name FROM Customer";
            var result = DapperHelper.QueryCollection <CustomerName>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化服务总线(使用WCF服务)
        /// </summary>
        public static void InitializeRemoteBus()
        {
            bizbus = new RemoteBizBus();
            RemoteBizBus     rbizbus    = bizbus as RemoteBizBus;
            string           configuri  = AppSettingConfig.getRemoteUriPath() + "Config";
            string           configPath = AppSettingConfig.getLocalConfigPath();
            BasicHttpBinding bhb        = new BasicHttpBinding("BasicHttpBinding_Service");
            EndpointAddress  epa        = new EndpointAddress(configuri);
            IHostConfig      hostconfig = ChannelFactory <IHostConfig> .CreateChannel(bhb, epa);

            XmlDocument doc = new XmlDocument();

            if (string.IsNullOrEmpty(configPath))
            {
                string configstring = hostconfig.GetConfigString();
                doc.LoadXml(configstring);
            }
            //else
            //{
            //    string file = AppDomain.CurrentDomain.BaseDirectory + @"\namespace DrectSoft.FrameWork.Config";
            //    doc.Load(file);
            //}

            List <ServicePackageInfo> packages = ConfigLoader.GetPackageList(doc.DocumentElement);

            rbizbus.packages = packages;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 自动注入配置文件(调用方法前,需要将配置信息注入IConfiguration中)
        /// </summary>
        /// <param name="services"></param>
        /// <param name="configuration"></param>
        /// <param name="appSettingConfig">默认更改或者读取的文件配置,如果不设置,则默认读取根目录的appsettings.json</param>
        /// <param name="isCompleteName">是否输入完整的类名,默认:false,为true时则需要输入命名空间+类名</param>
        /// <param name="action"></param>
        /// <param name="errConfigAction">配置信息错误回调</param>
        /// <returns></returns>
        public static IServiceCollection AddAutoConfig(this IServiceCollection services,
                                                       IConfiguration configuration,
                                                       AppSettingConfig appSettingConfig,
                                                       bool isCompleteName             = false, Action <ConfigAutoRegister> action = null,
                                                       Action <string> errConfigAction = null)
        {
            Load();
            ConfigAutoRegister configAutoRegisterExt = new ConfigAutoRegister();

            if (action == null)
            {
                configAutoRegisterExt.AddSingletonConfig(services, configuration, isCompleteName, errConfigAction);
                configAutoRegisterExt.AddScopedConfig(services, isCompleteName, errConfigAction);
                configAutoRegisterExt.AddTransientConfig(services, isCompleteName, errConfigAction);
            }
            else
            {
                action.Invoke(configAutoRegisterExt);
            }

            if (appSettingConfig == null)
            {
                appSettingConfig = new AppSettingConfig()
                {
                    DefaultPath = "appsettings.json"
                };
            }

            services.AddTransient(provider => appSettingConfig);
            services.AddTransient(typeof(IWritableOptions <>), typeof(WritableOptions <>));
            return(services);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 新增加工程序
        /// </summary>
        /// <param name="processSequenceDetails"></param>
        /// <returns></returns>
        public List <int> InsertProcessSequence(List <ProcessSequenceDetail> processSequenceDetails)
        {
            string sqlCmd = @"
            INSERT INTO [dbo].[ProcessSequence]
           ([FabricID]
           ,[FactoryID]
           ,[ProcessItem]
           ,[Loss]
           ,[WorkPay]
           ,[Order]
           ,[Group])
             OUTPUT INSERTED.SequenceNo
            VALUES
           (@FabricID
           ,@FactoryID
           ,@ProcessItem
           ,@Loss
           ,@WorkPay
           ,@Order
           ,@Group)";

            List <int> sequenceNoList = new List <int>();

            foreach (var item in processSequenceDetails)
            {
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@FabricID", SqlDbType.Int)
                    {
                        Value = item.FabricID
                    },
                    new SqlParameter("@FactoryID", SqlDbType.Int)
                    {
                        Value = item.FactoryID
                    },
                    new SqlParameter("@ProcessItem", SqlDbType.TinyInt)
                    {
                        Value = item.ProcessItem
                    },
                    new SqlParameter("@Loss", SqlDbType.Decimal)
                    {
                        Value = item.Loss
                    },
                    new SqlParameter("@WorkPay", SqlDbType.SmallInt)
                    {
                        Value = item.WorkPay
                    },
                    new SqlParameter("@Order", SqlDbType.TinyInt)
                    {
                        Value = item.Order
                    },
                    new SqlParameter("@Group", SqlDbType.TinyInt)
                    {
                        Value = item.Group
                    }
                };
                sequenceNoList.Add(DapperHelper.Query <int>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameters));
            }
            return(sequenceNoList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新客戶布種單價
        /// </summary>
        /// <returns></returns>
        public int UpdateCustomerTextilePrice(CustomerCheckBillSheet selectedCustomerCheckBillSheet, int updateCustomerPrice)
        {
            string sql = @"UPDATE dbo.CustomerTextilePrice
                           SET Price = @Price
                           WHERE AccountCustomerID = @AccountCustomerID AND AccountTextileID = @AccountTextileID";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@AccountCustomerID", SqlDbType.NChar)
                {
                    Value = selectedCustomerCheckBillSheet.C_01
                },
                new SqlParameter("@AccountTextileID", SqlDbType.Int)
                {
                    Value = selectedCustomerCheckBillSheet.AccountTextileID
                },
                new SqlParameter("@Price", SqlDbType.Int)
                {
                    Value = updateCustomerPrice
                }
            };
            var result = DapperHelper.ExecuteParameter(AppSettingConfig.ConnectionString(), CommandType.Text, sql, parameters);

            return(result);
        }
Ejemplo n.º 6
0
        public void CreateExcelFile <T>(CreateExcelAction <T> createExcelAction, List <T> list, ExcelFormat excelFormat)
        {
            //建立Excel 2003檔案
            IWorkbook wb  = new XSSFWorkbook();
            ISheet    ws  = wb.CreateSheet("Class");
            XSSFRow   row = (XSSFRow)ws.CreateRow(0);

            row.Height = 440;

            ICellStyle positionStyle = wb.CreateCellStyle();

            positionStyle.WrapText          = true;
            positionStyle.Alignment         = NPOI.SS.UserModel.HorizontalAlignment.Center;
            positionStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center;

            foreach (var item in excelFormat.ColumnFormats)
            {
                ws.SetColumnWidth(excelFormat.ColumnFormats.IndexOf(item), item.CoiumnWidth);
                CreateCell(row, excelFormat.ColumnFormats.IndexOf(item), item.ColumnTitle, positionStyle);
            }

            int rowIndex = 1;

            foreach (var storeData in list)
            {
                createExcelAction(wb, ws, positionStyle, ref rowIndex, storeData);
            }
            FileStream file = new FileStream(string.Concat(AppSettingConfig.FilePath(), @"\", excelFormat.FileName, DateTime.Now.ToString("yyyyMMdd"), ".xlsx"), FileMode.Create);//產生檔案

            wb.Write(file);
            file.Close();
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 取得所有紗商的紗價
        /// </summary>
        /// <returns></returns>
        public IEnumerable <MerchantYarnPrice> GetMerchantYarnPriceList()
        {
            string sqlCmd = @"SELECT * FROM YarnPrice";
            var    result = DapperHelper.QueryCollection <MerchantYarnPrice>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 8
0
        private IWorkbook workbook = null;  //新建IWorkbook對象
        public NewProcessOrderPage()
        {
            InitializeComponent();
            string fileName = string.Concat(AppSettingConfig.ProcessOrderFilePath(), AppSettingConfig.ProcessOrderFileName());

            try
            {
                FileStream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                workbook = new XSSFWorkbook(fileStream);  //xlsx數據讀入workbook
                var processOrderSheet = new List <string>();
                for (int sheetCount = 0; sheetCount < workbook.NumberOfSheets; sheetCount++)
                {
                    ISheet sheet = workbook.GetSheetAt(sheetCount);  //獲取第i個工作表
                    if (!sheet.SheetName.Contains("HY"))
                    {
                        continue;
                    }
                    processOrderSheet.Add(sheet.SheetName);
                }
                ComboBoxProcessOrderSheet.ItemsSource = processOrderSheet;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 9
0
        public IEnumerable <TrashItem> GetTrashItems()
        {
            var sqlCmd = "SELECT * FROM ITEM.dbf";
            var result = DapperHelper.QueryDbfCollection <TrashItem>(AppSettingConfig.DbfConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 10
0
        //var sqlCmd = @"update ProcessOrderFlowDate
        //                  set InputDate = @InputDate,
        //                     UpdateDate = GETDATE()
        //                 where OrderFlowNo = @OrderFlowNo and OrderColorDetailNo in @OrderColorDetailNo";
        //var parameter =
        //    new
        //    {
        //        OrderColorDetailNo = orderColorDetailNoList,
        //        InputDate = date,
        //        OrderFlowNo = orderFlowNo
        //    };
        public void UpdateProductName(string v)
        {
            string sqlCmd = @"SELECT * from ITEM.dbf WHERE I_03 Like '%*%'";//@"UPDATE ITEM.dbf SET I_03=REPLACE(I_03,'*','X') WHERE I_03 LIKE '%*%'";

            var result = DapperHelper.QueryDbfCollection <TrashItem>(AppSettingConfig.DbfConnectionString(), CommandType.Text, sqlCmd);

            var replace = result.Select(s => new TrashItem {
                I_03 = s.I_03.Replace("*", "X"), F_01 = s.F_01, I_01 = s.I_01
            });

            foreach (var item in replace)
            {
                string         sqlCmd2    = @"UPDATE ITEM.dbf SET I_03=@I_03 WHERE F_01=@F_01 AND I_01=@I_01";
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@I_03", SqlDbType.NVarChar)
                    {
                        Value = item.I_03
                    },
                    new SqlParameter("@F_01", SqlDbType.NVarChar)
                    {
                        Value = item.F_01
                    },
                    new SqlParameter("@I_01", SqlDbType.NVarChar)
                    {
                        Value = item.I_01
                    },
                };
                var count = DapperHelper.QueryDbfCollection <int>(AppSettingConfig.DbfConnectionString(), CommandType.Text, sqlCmd2, parameters);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 取得客戶出貨紀錄
        /// </summary>
        /// <param name="customerName"></param>
        /// <param name="customerDatePickerBegin"></param>
        /// <param name="customerDatePickerEnd"></param>
        /// <returns></returns>
        public IEnumerable <TrashCustomerShipped> GetCustomerShippedList(string customerName, DateTime customerDatePickerBegin, DateTime customerDatePickerEnd)
        {
            string sqlCmd = "";

            if (string.IsNullOrEmpty(customerName))
            {
                sqlCmd = string.Concat(@"SELECT DISTINCT cust.C_Name,invosub.IN_DATE,invosub.I_01,item.I_03,invosub.QUANTITY FROM (CUST.dbf AS cust 
                            INNER JOIN INVOSUB.dbf AS invosub ON cust.CARD_NO = invosub.C_01)
                            INNER JOIN ITEM.dbf AS item ON invosub.I_01 = ITEM.I_01 AND invosub.F_01 = ITEM.F_01 
                            WHERE invosub.IN_DATE Between cDate('" + customerDatePickerBegin.ToString() + "') and cDate('" + customerDatePickerEnd.ToString() + "')");
            }
            else
            {
                sqlCmd = @"SELECT DISTINCT cust.C_Name,invosub.IN_DATE,invosub.I_01,item.I_03,invosub.QUANTITY FROM (CUST.dbf AS cust 
                            INNER JOIN INVOSUB.dbf AS invosub ON cust.CARD_NO = invosub.C_01)
                            INNER JOIN ITEM.dbf AS item ON invosub.I_01 = ITEM.I_01 AND  invosub.F_01 = ITEM.F_01
                            WHERE cust.C_NAME = '" + customerName + "' AND invosub.IN_DATE Between cDate('" + customerDatePickerBegin.ToString() + "') and cDate('" + customerDatePickerEnd.ToString() + "')";
            }
            //SqlParameter[] parameters = new SqlParameter[]
            //{
            //    new SqlParameter("@CustomerName", SqlDbType.NVarChar) { Value = customerName },
            //};
            var result = DapperHelper.QueryDbfCollection <TrashCustomerShipped>(AppSettingConfig.DbfConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 取得客戶清單
        /// </summary>
        public IEnumerable <TrashCustomer> GetCustomerList()
        {
            var sqlCmd = @"SELECT CARD_NO,C_NAME FROM CUST.dbf";
            var result = DapperHelper.QueryDbfCollection <TrashCustomer>(AppSettingConfig.DbfConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 13
0
        private static void InitExcelHandlers()
        {
            // 指定的多个带有controller的assembly的名称
            string handlerAssemblies = AppSettingConfig.GetSetting("ExcelHandlerAssemblies", "");  //"Wanda.HR.KPI.Web.Common";

            _excelHandlers = new Dictionary <string, ExcelCategoryHandler>();

            string[]    assemblyArray = handlerAssemblies.Split(",;".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            List <Type> handlerTypes  = new List <Type>();

            foreach (var assembly in assemblyArray)
            {
                var types = (from t in Assembly.Load(assembly).GetTypes()
                             where IsSubClassOf(t, typeof(ExcelCategoryHandler))
                             select t).ToList();
                handlerTypes.AddRange(types);
            }



            foreach (Type type in handlerTypes)
            {
                string typeName = type.Name.ToLower();
                // todo alias

                ExcelCategoryHandler handler = (ExcelCategoryHandler)Activator.CreateInstance(type);

                _excelHandlers.Add(typeName, handler);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 修改加工程序,可修改工繳,損耗,順序
        /// </summary>
        /// <param name="sequenceNo"></param>
        /// <param name="loss"></param>
        /// <param name="workPay"></param>
        /// <param name="order"></param>
        /// <returns></returns>
        public int EditProcessSequence(int sequenceNo, decimal loss, int workPay, int order)
        {
            var sqlCmd = @"UPDATE [dbo].[ProcessSequence]
                           SET 
                            [Loss] = @Loss
                           ,[WorkPay] = @WorkPay
                           ,[Order] = @Order
                           WHERE SequenceNo=@SequenceNo";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@SequenceNo", SqlDbType.Int)
                {
                    Value = sequenceNo
                },
                new SqlParameter("@Loss", SqlDbType.Decimal)
                {
                    Value = loss
                },
                new SqlParameter("@WorkPay", SqlDbType.Int)
                {
                    Value = workPay
                },
                new SqlParameter("@Order", SqlDbType.Int)
                {
                    Value = order
                }
            };
            var result = DapperHelper.ExecuteParameter(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameters);

            return(result);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 新增紗規格
        /// </summary>
        /// <param name="yarnSpecification"></param>
        /// <returns></returns>
        public int AddYarnSpecification(YarnSpecification yarnSpecification)
        {
            string sqlCmd = @"INSERT INTO [dbo].[YarnSpecification]
            ([Ingredient],[YarnCount],[Color])
            VALUES
            (@Ingredient,@YarnCount,@Color)";

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Ingredient", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.Ingredient
                },
                new SqlParameter("@YarnCount", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.YarnCount
                },
                new SqlParameter("@Color", SqlDbType.NVarChar)
                {
                    Value = yarnSpecification.Color
                }
            };
            var result = DapperHelper.ExecuteParameter(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameters);

            return(result);
        }
Ejemplo n.º 16
0
        public int UpdateProcessOrderFlowDate(List <ProcessOrderFlowFactoryName> processOrderFlow)
        {
            string sql   = @"UPDATE ProcessOrderFlow SET InputDate = @InputDate,CompleteDate = @CompleteDate WHERE OrderDetailNo = @OrderDetailNo;";
            var    count = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sql, processOrderFlow);

            return(count);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 取得所有布種預設單價
        /// </summary>
        /// <returns></returns>
        public IEnumerable <AccountTextile> GetAccountTextile()
        {
            string sql    = @"SELECT * FROM AccountTextile;";
            var    result = DapperHelper.QueryCollection <AccountTextile>(AppSettingConfig.ConnectionString(), CommandType.Text, sql);

            return(result);
        }
Ejemplo n.º 18
0
        private void ComboBoxSelectionChangedExecute()
        {
            string priviousTextile = SelectedTextile;

            TextileColorList = null;
            TextileList      = null;
            RaisePropertyChanged("TextileColorList");
            RaisePropertyChanged("TextileList");
            List <string> textileList = new List <string>();

            if (!_workbookDictionary.TryGetValue(FileName, out IWorkbook dictionaryWorkbook))
            {
                string fileNamePath = string.Concat(AppSettingConfig.InventoryHistoryRecordFilePath(), "/", FileName);
                Tuple <List <string>, IWorkbook> tuple = ExcelModule.GetExcelWorkbook(fileNamePath);
                TextileList = tuple.Item1;
                GetShippingDate(tuple.Item2.GetSheetAt(1));
                _workbookDictionary.Add(FileName, tuple.Item2);
            }
            else
            {
                for (int sheetCount = 1; sheetCount < dictionaryWorkbook.NumberOfSheets; sheetCount++)
                {
                    ISheet sheet = dictionaryWorkbook.GetSheetAt(sheetCount);  //獲取第i個工作表
                    textileList.Add(sheet.SheetName);
                }
                TextileList = textileList;
                GetShippingDate(dictionaryWorkbook.GetSheetAt(1));
            }
            RaisePropertyChanged("TextileList");
            SelectedTextile = priviousTextile;
            RaisePropertyChanged("SelectedTextile");
        }
Ejemplo n.º 19
0
        public int NewProcessOrderFlow(ProcessOrderFlow processOrderFlow, IEnumerable <int> orderColorDetailNo)
        {
            var sqlCmd = @"INSERT INTO ProcessOrderFlow
                           OUTPUT  inserted.OrderDetailNo
                           VALUES 
                           (@OrderNo,@FactoryID);";

            SqlParameter[] parameter = new SqlParameter[]
            {
                new SqlParameter("@OrderNo", SqlDbType.Int)
                {
                    Value = processOrderFlow.OrderNo
                },
                new SqlParameter("@FactoryID", SqlDbType.Int)
                {
                    Value = processOrderFlow.FactoryID
                }
            };
            var orderDetailNo = DapperHelper.Query <int>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameter);


            var cmd        = @"INSERT INTO ProcessOrderFlowDate
                        VALUES(@OrderColorDetailNo,@OrderDetailNo,null,null,GETDATE());";
            var parameters =
                orderColorDetailNo.Select(s => new { OrderColorDetailNo = s, OrderDetailNo = orderDetailNo, });
            var count = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, cmd, parameters);

            return(count);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 取得布種清單
        /// </summary>
        /// <returns></returns>
        public IEnumerable <Fabric> GetFabricList()
        {
            string sqlCmd = "SELECT * FROM Fabric";
            var    result = DapperHelper.QueryCollection <Fabric>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd);

            return(result);
        }
Ejemplo n.º 21
0
        public int UpdateProcessOrderColorDetailStatusByLastComplete(int orderFlowNo, IEnumerable <int> orderColorDetailNoList)
        {
            var sqlCmd    = @" DECLARE @lastOrderFlowNo INT

                            SELECT TOP 1 @lastOrderFlowNo = OrderFlowNo  FROM ProcessOrderFlowDate
                            WHERE OrderColorDetailNo = @OrderColorDetailNo
                            ORDER BY OrderFlowNo DESC

                            IF(@lastOrderFlowNo = @OrderFlowNo)
	                             begin
	                                UPDATE ProcessOrderColorDetail
                                    SET Status = 5,
                                    UpdateDate = GETDATE()
                                    WHERE OrderColorDetailNo IN @OrderColorDetailNoList
                                 end";
            var parameter =
                new
            {
                OrderColorDetailNo     = orderColorDetailNoList.First(),
                OrderFlowNo            = orderFlowNo,
                OrderColorDetailNoList = orderColorDetailNoList
            };
            var count = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameter);

            return(count);
        }
        /// <summary>
        /// 得到配置
        /// </summary>
        /// <param name="appSettingConfig"></param>
        /// <returns></returns>
        private AppSettingConfig GetAppSettingConfig(AppSettingConfig appSettingConfig)
        {
            var settingConfig = appSettingConfig ?? new AppSettingConfig();

            settingConfig.Maps        = SafeList(settingConfig.Maps);
            settingConfig.DefaultPath = settingConfig.DefaultPath.SafeString();
            return(settingConfig);
        }
Ejemplo n.º 23
0
        public int InsertProcessOrderFlowDate(List <ProcessOrderFlowDate> proecessOrderFlowDateList)
        {
            string sql = @"INSERT INTO ProcessOrderFlowDate
                           VALUES 
                           (@OrderColorDetailNo,@OrderFlowNo,@InputDate,@CompleteDate,@UpdateDate);";

            return(DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sql, proecessOrderFlowDateList));
        }
Ejemplo n.º 24
0
        static void Main()
        {
            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);
            // Set the unhandled exception mode to force all Windows Forms errors to go through our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //get config file
            Shop         currentShop    = null;
            const string appSettingPath = "Config/AppSetting.config";

            if (File.Exists(appSettingPath))
            {
                AppSettingConfig appSettingConfig = XmlUtil.Deserialize <AppSettingConfig>(appSettingPath);
                ConstantValuePool.BizSettingConfig = appSettingConfig;
                ShopService shopService = new ShopService();
                currentShop = shopService.GetCurrentShop(appSettingConfig.IPAddress, appSettingConfig.Port);
            }
            if (currentShop != null && !string.IsNullOrEmpty(currentShop.ShopNo))
            {
                ConstantValuePool.CurrentShop = currentShop;
                //Check for registration
                int remainDays = 0;
                if (true)    //(ProductRegister.CheckProductRegistration(ref remainDays))
                {
                    Application.Run(new FormLogin());
                }
                else
                {
                    string   strVersion        = string.Empty;
                    Assembly executingAssembly = Assembly.GetExecutingAssembly();
                    object[] objectAttrs       = executingAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
                    if (objectAttrs.Length > 0)
                    {
                        AssemblyFileVersionAttribute fileAttr = objectAttrs[0] as AssemblyFileVersionAttribute;
                        if (fileAttr != null)
                        {
                            strVersion = fileAttr.Version;
                        }
                    }
                    FormProductTry formTry = new FormProductTry(remainDays, currentShop.ShopName, currentShop.ShopNo, strVersion);
                    formTry.ShowDialog();
                    if (formTry.Result)
                    {
                        Application.Run(new FormLogin());
                    }
                }
            }
            else
            {
                MessageBox.Show("找不到有效的服务端程序,请检查服务是否启动或者配置是否正确。", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                Application.Run(new FormConfig());
            }
        }
Ejemplo n.º 25
0
        private static List <Message> GetAllSuccess()
        {
            IConfigurationRoot root = AppSettingConfig.GetAppSettingConfig();
            var    errors           = root.GetSection("SystemMessages");
            string filePath         = errors["JsonSuccessPath"].ToLower();
            string json             = File.ReadAllText(filePath);

            return(JsonConvert.DeserializeObject <List <Message> >(json));
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 取得工廠編號
        /// </summary>
        /// <param name="FactoryName"></param>
        /// <returns></returns>
        public IEnumerable <FactoryIdentity> GetFactoryIdentiys(string[] FactoryNameString)
        {
            var sqlCmd    = "SELECT FactoryID,Name FROM Factory WHERE Name IN @Name";
            var parameter = (new { Name = FactoryNameString });
            //var y = (new { Name = new[] { "強金利", "祥玉" } });
            var result = DapperHelper.QueryCollection <FactoryIdentity, object>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameter);

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// 新增工廠清單
        /// </summary>
        /// <param name="factory"></param>
        /// <returns></returns>
        public int InsertFactory(Factory factory)
        {
            var sqlCmd = @"INSERT INTO [dbo].[Factory]
                           VALUES
                           (@Name,@PhoneNumber,@CellPhone,@Fax,@Process,@Address,@Sort)";
            var result = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, factory);

            return(result);
        }
Ejemplo n.º 28
0
        public int InsertProcessOrderFlow(List <ProcessOrderFlow> processOrderFlow)
        {
            string sql    = @"INSERT INTO ProcessOrderFlow
                           VALUES 
                           (@OrderNo,@FactoryID);";
            var    result = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sql, processOrderFlow);

            return(result);
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 新增布種
        /// </summary>
        /// <param name="fabric"></param>
        /// <returns></returns>
        public int AddFabric(Fabric fabric)
        {
            var sqlCmd = @"INSERT INTO [dbo].[Fabric]
                           VALUES
                           (@FabricName,@AverageUnitPrice,@AverageCost,@UpdateDate)";
            var result = DapperHelper.Execute(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, fabric);

            return(result);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 依據多個加工訂單顏色明細編號號取得工廠直送清單
        /// </summary>
        /// <param name="processOrderColorDetailNo"></param>
        /// <returns></returns>
        public IEnumerable <FactoryShippingName> GetFactoryShippingNameList(IEnumerable <int> processOrderColorDetailNo)
        {
            var sqlCmd    = @"select fs.ShippingNo,fs.OrderColorDetailNo,c.Name,fs.Quantity,fs.CreateDate,fs.ShippingDate from FactoryShipping fs
                           inner join Customer c on c.CustomerID = fs.CustomerID
                           where OrderColorDetailNo IN @OrderColorDetailNo";
            var parameter = (new { OrderColorDetailNo = processOrderColorDetailNo });

            return(DapperHelper.QueryCollection <FactoryShippingName, object>(AppSettingConfig.ConnectionString(), CommandType.Text, sqlCmd, parameter));
        }