Esempio n. 1
0
    public static void Bind(object obj1, string prop1,
                            object obj2, string prop2)
    {
        string event1 = prop1 + "Changed";
        string event2 = prop2 + "Changed";

        Type t1 = obj1.GetType();
        Type t2 = obj2.GetType();

        EventInfo ei1 = t1.GetEvent(event1);
        EventInfo ei2 = t2.GetEvent(event2);

        BindHelper bh = new BindHelper(obj1, prop1, obj2, prop2);

        // The signature of the event
        // delegate must be of the form
        // (object, EventArgs).
        // Although events don't have to be
        // of this signature, this is a good
        // reason to comply with the .NET guidelines.

        // Unfortunately, .NET 1.1 does not
        // handle event signatures that are
        // derived from EventArgs when programatically
        // adding a generic handler.
        // This "bug" is corrected in .NET 2.0!

        ei1.AddEventHandler(obj1,
                            new EventHandler(bh.SourceChanged));
        ei2.AddEventHandler(obj2,
                            new EventHandler(bh.DestinationChanged));

        bh.DestinationChanged(bh, EventArgs.Empty);
    }
Esempio n. 2
0
 private void BtnCancel_Click(object sender, RoutedEventArgs e)
 {
     //取消
     gbItem.IsCollapsed = true;
     gbItem.Visibility  = Visibility.Collapsed;
     BindHelper.SetDictDataBindingGridItem(gbItem, Griditem);
 }
Esempio n. 3
0
        private void BtnItemSave_Click(object sender, RoutedEventArgs e)
        {
            //TreeListNode item = tvMain.SelectedItem as TreeListNode;
            //if ((item == null) || (item.Tag.ToString() == ""))
            //{
            //    gridItem.ItemsSource = null;
            //    return;
            //}
            //SysEnumMain m_SysEnumMain = item.Tag as SysEnumMain;

            SysEnumMain m_SysEnumMain = tvMain.SelectedItem as SysEnumMain;

            if ((m_SysEnumMain == null) || (string.IsNullOrEmpty(m_SysEnumMain.PKNO)))
            {
                return;
            }

            SysEnumItems m_SysEnumItems = gbItem.DataContext as SysEnumItems;

            if (m_SysEnumItems == null)
            {
                return;
            }

            #region  校验

            if (string.IsNullOrEmpty(m_SysEnumItems.ITEM_NAME))
            {
                Brush oldBrush = this.tbItemName.BorderBrush;
                this.tbItemName.BorderBrush = Brushes.Red;
                System.Windows.Forms.MessageBox.Show("请输入明细名称。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.tbItemName.BorderBrush = oldBrush;
                return;
            }

            #endregion

            if (string.IsNullOrEmpty(m_SysEnumItems.PKNO)) //新增
            {
                m_SysEnumItems.PKNO = Guid.NewGuid().ToString("N");

                ws.UseService(s => s.AddSysEnumItems(m_SysEnumItems));

                //重新刷新数据
                List <SysEnumItems> mSysEnumItemses =
                    ws.UseService(s => s.GetSysEnumItemss($"ENUM_IDENTIFY = {m_SysEnumMain.ENUM_IDENTIFY} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.ITEM_INDEX)
                    .ToList();
                gridItem.ItemsSource = mSysEnumItemses;
            }
            else  //修改
            {
                ws.UseService(s => s.UpdateSysEnumItems(m_SysEnumItems));
            }
            //提示保存成功

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 4
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            RsFactory m_RsFactory = gbItem.DataContext as RsFactory;

            if (m_RsFactory == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(m_RsFactory.PKNO)) //新增
            {
                m_RsFactory.PKNO             = Guid.NewGuid().ToString("N");
                m_RsFactory.CREATION_DATE    = DateTime.Now;
                m_RsFactory.CREATED_BY       = CBaseData.LoginName;
                m_RsFactory.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期

                ws.UseService(s => s.AddRsFactory(m_RsFactory));
            }
            else  //修改
            {
                m_RsFactory.LAST_UPDATE_DATE = DateTime.Now;
                m_RsFactory.UPDATED_BY       = CBaseData.LoginName;
                ws.UseService(s => s.UpdateRsFactory(m_RsFactory));
            }

            Initialize();  //重新加载

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 5
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            SysTableNOSetting tableNo = gbItem.DataContext as SysTableNOSetting;

            if (tableNo == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(tableNo.PKNO)) //新增
            {
                tableNo.PKNO             = Guid.NewGuid().ToString("N");
                tableNo.CREATION_DATE    = DateTime.Now;
                tableNo.CREATED_BY       = CBaseData.LoginName;
                tableNo.LAST_UPDATE_DATE = DateTime.Now;

                ws.UseService(s => s.AddSysTableNOSetting(tableNo));
            }
            else  //修改
            {
                tableNo.LAST_UPDATE_DATE = DateTime.Now;
                tableNo.UPDATED_BY       = CBaseData.LoginName;
                ws.UseService(s => s.UpdateSysTableNOSetting(tableNo));
            }

            GetPage();  //重新加载

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 6
0
  public static void Bind(object obj1, string prop1,
                            object obj2, string prop2)
  {
    string event1=prop1+"Changed";
    string event2=prop2+"Changed";

    Type t1=obj1.GetType();
    Type t2=obj2.GetType();

    EventInfo ei1=t1.GetEvent(event1);
    EventInfo ei2=t2.GetEvent(event2);

    BindHelper bh=new BindHelper(obj1, prop1, obj2, prop2);

    // The signature of the event 
    // delegate must be of the form 
    // (object, EventArgs).
    // Although events don't have to be 
    // of this signature, this is a good
    // reason to comply with the .NET guidelines.

    // Unfortunately, .NET 1.1 does not 
    // handle event signatures that are 
    // derived from EventArgs when programatically 
    // adding a generic handler.
    // This "bug" is corrected in .NET 2.0!

    ei1.AddEventHandler(obj1, 
         new EventHandler(bh.SourceChanged));
    ei2.AddEventHandler(obj2, 
         new EventHandler(bh.DestinationChanged));

    bh.DestinationChanged(bh, EventArgs.Empty);
  }
Esempio n. 7
0
        private void BtnItemDel_Click(object sender, RoutedEventArgs e)
        {
            WmsAreaInfo m_WmsAreaInfo = tvMain.SelectedItem as WmsAreaInfo;

            if ((m_WmsAreaInfo == null) || (string.IsNullOrEmpty(m_WmsAreaInfo.PKNO)))
            {
                return;
            }
            //删除明细
            WmsAllocationInfo m_AllocationInfo = gridItem.SelectedItem as WmsAllocationInfo;

            if (m_AllocationInfo == null)
            {
                return;
            }

            if (System.Windows.Forms.MessageBox.Show($"确定删除货位信息【{m_AllocationInfo.ALLOCATION_NAME}】吗?",
                                                     @"删除信息",
                                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
            {
                m_AllocationInfo.USE_FLAG = -1;
                ws.UseService(s => s.UpdateWmsAllocationInfo(m_AllocationInfo));

                //删除成功.
                List <WmsAllocationInfo> mWmsAllocationInfos =
                    ws.UseService(s => s.GetWmsAllocationInfos($"AREA_PKNO = {m_WmsAreaInfo.PKNO} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.CREATION_DATE)
                    .ToList();
                gridItem.ItemsSource = mWmsAllocationInfos;

                BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
            }
        }
Esempio n. 8
0
        private void BtnItemUse_Click(object sender, RoutedEventArgs e)
        {
            FmsActionFormulaMain main = tvMain.SelectedItem as FmsActionFormulaMain;

            if ((main == null) || (string.IsNullOrEmpty(main.PKNO)))
            {
                return;
            }
            //可用明细
            FmsActionFormulaDetail detail = gridItem.SelectedItem as FmsActionFormulaDetail;

            if (detail == null)
            {
                return;
            }

            if (WPFMessageBox.ShowConfirm($"确定[{BtnItemUse.Content}]动作配方明细信息【{detail.FORMULA_DETAIL_NAME}】吗?", @"删除信息") == WPFMessageBoxResult.OK)
            {
                detail.USE_FLAG = (detail.USE_FLAG == 1) ? 0 : 1;
                ws.UseService(s => s.UpdateFmsActionFormulaDetail(detail));

                //可用成功.
                List <FmsActionFormulaDetail> details =
                    ws.UseService(s => s.GetFmsActionFormulaDetails($"FORMULA_CODE = {main.FORMULA_CODE} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.PROCESS_INDEX)
                    .ToList();
                gridItem.ItemsSource = details;

                BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
            }
        }
Esempio n. 9
0
        /// <summary>
        ///  逻辑删除
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <param name="info">实体</param>
        /// <returns>删除行数</returns>
        public int LogicDelete <T>(T info) where T : new()
        {
            int    count     = 0;
            string tableName = "";
            string sql       = "";

            string where = "";
            string UPDATEUSR = "";
            T      oldInfo   = default(T);
            DataChangeManageDAL  markManager = new DataChangeManageDAL();
            List <DataParameter> parameters  = new List <DataParameter>();

            try
            {
                //获取表名
                Type             type          = typeof(T);
                object[]         attrsClassAtt = type.GetCustomAttributes(typeof(DBTableAttribute), true);
                DBTableAttribute tableAtt      = (DBTableAttribute)attrsClassAtt[0];
                tableName = tableAtt.TableName;

                //获取主键信息
                Dictionary <string, object> pkColumns = new DataQueryHelper().GetPkColumns <T>(info);

                UPDATEUSR = BindHelper.GetPropertyValue(info, "UPDATEUSER") == null ? "" : BindHelper.GetPropertyValue(info, "UPDATEUSER").ToString();

                //获取原实体
                oldInfo = (T)(info as BaseEntity).Clone();
                oldInfo = this.BaseSession.Get <T>(info);

                //获取数据主键
                string dataID = this.GetEntityDataID <T>(info);

                //逻辑删除
                sql = string.Format("UPDATE {0} SET FLGDEL='1',UPDATEDATE=GETDATE(),UPDATEUSER=@UPDATEUSER WHERE ", tableName, UPDATEUSR);

                parameters.Add(new DataParameter("UPDATEUSER", UPDATEUSR));

                foreach (string key in pkColumns.Keys)
                {
                    where += " AND " + key + " = @" + key;
                    parameters.Add(new DataParameter(key, pkColumns[key]));
                }

                sql += where.Substring(4);

                sql   = this.ChangeSqlByDB(sql, this.BaseSession);
                count = this.BaseSession.ExecuteSql(sql, parameters.ToArray());

                //记录痕迹
                markManager.Session = this.BaseSession;
                //markManager.RecordDataChangeMarkDetail<T>(DataOprType.Delete, UPDATEUSR, dataID, oldInfo, info);


                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 10
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存

            SysPurview m_SysPurview = gbItem.DataContext as SysPurview;

            if (m_SysPurview == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(m_SysPurview.PKNO)) //新增
            {
                m_SysPurview.PKNO             = Guid.NewGuid().ToString("N");
                m_SysPurview.CREATION_DATE    = DateTime.Now;
                m_SysPurview.CREATED_BY       = CBaseData.LoginName;
                m_SysPurview.LAST_UPDATE_DATE = DateTime.Now;

                _SDMService.UseService(s => s.AddSysPurview(m_SysPurview));
            }
            else  //修改
            {
                m_SysPurview.LAST_UPDATE_DATE = DateTime.Now;
                m_SysPurview.UPDATED_BY       = CBaseData.LoginName;
                _SDMService.UseService(s => s.UpdateSysPurview(m_SysPurview));
            }

            Initialize();  //重新加载

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, Griditem);
        }
Esempio n. 11
0
 private void BtnCancel_Click(object sender, DevExpress.Xpf.Bars.ItemClickEventArgs e)
 {
     //取消
     gbItem.IsCollapsed = true;
     gbItem.Visibility  = Visibility.Collapsed;
     BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
 }
Esempio n. 12
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            TmsToolsType m_TmsToolsType = gbItem.DataContext as TmsToolsType;

            if (m_TmsToolsType == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(m_TmsToolsType.TOOLS_TYPE_CODE))
            {
                System.Windows.Forms.MessageBox.Show("请输入刀具类型编号!", "保存", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            if (string.IsNullOrEmpty(m_TmsToolsType.PKNO)) //新增
            {
                TmsToolsType check =
                    ws.UseService(s => s.GetTmsToolsTypes($"TOOLS_TYPE_CODE = '{m_TmsToolsType.TOOLS_TYPE_CODE}'"))
                    .FirstOrDefault();
                if (check != null)
                {
                    System.Windows.Forms.MessageBox.Show("该刀具类型编号已经存在,不能新增相同的刀具类型编号!", "保存", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                m_TmsToolsType.PKNO             = Guid.NewGuid().ToString("N");
                m_TmsToolsType.CREATION_DATE    = DateTime.Now;
                m_TmsToolsType.CREATED_BY       = CBaseData.LoginName;
                m_TmsToolsType.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期

                ws.UseService(s => s.AddTmsToolsType(m_TmsToolsType));
            }
            else  //修改
            {
                TmsToolsType check =
                    ws.UseService(
                        s =>
                        s.GetTmsToolsTypes(
                            $"TOOLS_TYPE_CODE = '{m_TmsToolsType.TOOLS_TYPE_CODE}' AND PKNO <> '{m_TmsToolsType.PKNO}'"))
                    .FirstOrDefault();
                if (check != null)
                {
                    System.Windows.Forms.MessageBox.Show("该刀具类型编号已经存在,不能修改为该刀具类型编号!", "保存", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                m_TmsToolsType.LAST_UPDATE_DATE = DateTime.Now;
                m_TmsToolsType.UPDATED_BY       = CBaseData.LoginName;
                ws.UseService(s => s.UpdateTmsToolsType(m_TmsToolsType));
            }

            GetPage();  //重新加载

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 13
0
        private void GetPage()
        {
            List <PmTaskMaster> taskMasters = ws.UseService(s => s.GetPmTaskMasters("RUN_STATE < 2 "));

            gridItem.ItemsSource = taskMasters;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 14
0
        public EnumView()
        {
            InitializeComponent();

            GetMainData();

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 15
0
        private void GetPage()
        {
            List <QmsCheckParam> qmsCheckParams = ws.UseService(s => s.GetQmsCheckParams("USE_FLAG = 1 "));

            gridItem.ItemsSource = qmsCheckParams;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 16
0
        private void GetPage()
        {
            List <MesJobOrder> taskLines = ws.UseService(s => s.GetMesJobOrders("RUN_STATE >= 1 AND RUN_STATE < 10 AND USE_FLAG = 1"));

            gridItem.ItemsSource = taskLines;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 17
0
        private void GetPage()
        {
            List <PmPlanMaster> planMasters = ws.UseService(s => s.GetPmPlanMasters("RUN_STATE = 0 AND DISPATCH_QTY = 0"));

            gridItem.ItemsSource = planMasters;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 18
0
        public ActionControl()
        {
            InitializeComponent();

            GetPage();

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 19
0
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            //保存
            RsRoutingHead m_RsRoutingHead = gbItem.DataContext as RsRoutingHead;

            if (m_RsRoutingHead == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(m_RsRoutingHead.PKNO)) //新增
            {
                m_RsRoutingHead.PKNO             = Guid.NewGuid().ToString("N");
                m_RsRoutingHead.CREATION_DATE    = DateTime.Now;
                m_RsRoutingHead.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期
                m_RsRoutingHead.CREATED_BY       = CBaseData.LoginName;

                //关系中间表RsRoutingItem插入信息
                if (m_RsItemMaster != null)
                {
                    RsRoutingItem m_RsRoutingItem = new RsRoutingItem();
                    m_RsRoutingItem.PKNO             = Guid.NewGuid().ToString("N");
                    m_RsRoutingItem.ITEM_PKNO        = m_RsItemMaster.PKNO;
                    m_RsRoutingItem.ROUTING_PKNO     = m_RsRoutingHead.PKNO;
                    m_RsRoutingItem.CREATION_DATE    = DateTime.Now;
                    m_RsRoutingItem.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期
                    m_RsRoutingItem.CREATED_BY       = CBaseData.LoginName;
                    ws.UseService(s => s.AddRsRoutingItem(m_RsRoutingItem));
                }



                ws.UseService(s => s.AddRsRoutingHead(m_RsRoutingHead));
            }
            else  //修改
            {
                m_RsRoutingHead.LAST_UPDATE_DATE = DateTime.Now;
                m_RsRoutingHead.UPDATED_BY       = CBaseData.LoginName;
                ws.UseService(s => s.UpdateRsRoutingHead(m_RsRoutingHead));
                if (m_RsItemMaster != null)
                {
                    RsRoutingItem m_RsRoutingItem = new RsRoutingItem();
                    m_RsRoutingItem.PKNO             = Guid.NewGuid().ToString("N");
                    m_RsRoutingItem.ITEM_PKNO        = m_RsItemMaster.PKNO;
                    m_RsRoutingItem.ROUTING_PKNO     = m_RsRoutingHead.PKNO;
                    m_RsRoutingItem.CREATION_DATE    = DateTime.Now;
                    m_RsRoutingItem.LAST_UPDATE_DATE = DateTime.Now;  //最后修改日期
                    m_RsRoutingItem.CREATED_BY       = CBaseData.LoginName;
                    ws.UseService(s => s.AddRsRoutingItem(m_RsRoutingItem));
                }
            }

            Initialize();  //重新加载

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 20
0
 public void Run()
 {
     // Enum binding
     var flowers = BindHelper.Bind <Flower, FlowerId>((o, e) =>
     {
         o.Id   = e;
         o.Name = e.ToString();
     });
 }
Esempio n. 21
0
 private void BtnCancel_Click(object sender, RoutedEventArgs e)
 {
     //取消
     gbItem.IsCollapsed  = true;
     dictInfo.Visibility = Visibility.Collapsed;
     inbound.Visibility  = Visibility.Collapsed;
     outbound.Visibility = Visibility.Collapsed;
     BindHelper.SetDictDataBindingGridItem(dictInfo, gridItem);
 }
Esempio n. 22
0
        private void GetPage()
        {
            List <PmTaskLine> taskLines =
                ws.UseService(s => s.GetPmTaskLines("USE_FLAG = 1")).OrderBy(c => c.CREATION_DATE).ToList();

            gridItem.ItemsSource = taskLines;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 23
0
        private Task ThirdBatch(List <OracleCost> list)
        {
            var groupedOracleCostList = list
                                        .GroupBy(q => q.QuoteNumber, (quoteNumber, quoteRevenues) => new
            {
                key   = quoteNumber,
                value = quoteRevenues
            });

            using (TransactionScope scope = new TransactionScope())
            {
                foreach (var group in groupedOracleCostList)
                {
                    string  quoteNumber = group.key.Trim();
                    Project dbProject   = _projectRepository.GetBy(p => p.QuoteNumber == quoteNumber).FirstOrDefault();
                    new ExcelImportOrderIncorrectExceptionTriger(dbProject);
                    Income[] incomes = BindHelper.GetIncomes(group.value.ToArray(), dbProject.Id);

                    //根据kickoff的年月和币种得到汇率
                    string yearmonth          = dbProject.GetYearAndMonthString();
                    List <ExchangeRate> rates = _exchangeRateRepository.GetBy(r => r.YearMonthDate == yearmonth).ToList();
                    if (rates.Count == 0)
                    {
                        throw new Exception("请先上传当月的Exchange rate");
                    }
                    else
                    {
                        float finalCost = 0, different = 0;
                        foreach (var income in incomes)
                        {
                            ExchangeRate rate = rates.FirstOrDefault(r => r.Currency == income.OracleCurrency);
                            if (rate == null)
                            {
                                throw new ExchangeRateMissingException(yearmonth, income.OracleCurrency);
                            }
                            finalCost         += income.CostAmount / rate.Rate;
                            income.ExchageRate = rate.Rate;
                            income.Format();
                        }

                        OracleCost one = group.value.First();
                        different                   = finalCost - dbProject.TotalBooking;
                        dbProject.FinalCost         = finalCost;
                        dbProject.different         = different;
                        dbProject.Status            = one.Status;
                        dbProject.ProjectClosedDate = one.ProjectClosedDate;
                        dbProject.Format();
                        _incomeRepository.BatchAdd(incomes);
                        _projectRepository.Update(dbProject);
                    }
                }
                _projectRepository.Save();
                scope.Complete();
            }
            return(Task.CompletedTask);
        }
Esempio n. 24
0
        private void GetPage()
        {
            List <MesJobOrder> mesJobOrders =
                ws.UseService(s => s.GetMesJobOrders($"USE_FLAG = 1 AND LINE_PKNO = '{CBaseData.CurLinePKNO}'"))
                .OrderBy(c => c.CREATION_DATE).ToList();

            gridItem.ItemsSource = mesJobOrders;

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 25
0
        public AssetCommParamSetting()
        {
            InitializeComponent();

            cmbInterfaceType.ItemsSource = EnumHelper.GetEnumsToList <DeviceCommInterface>().DefaultView;

            GetPage();

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 26
0
        private void BtnItemSave_Click(object sender, RoutedEventArgs e)
        {
            FmsActionFormulaMain main = tvMain.SelectedItem as FmsActionFormulaMain;

            if ((main == null) || (string.IsNullOrEmpty(main.PKNO)))
            {
                return;
            }
            FmsActionFormulaDetail detail = gbItem.DataContext as FmsActionFormulaDetail;

            if (detail == null)
            {
                return;
            }

            #region  校验

            if (string.IsNullOrEmpty(detail.FORMULA_CODE))
            {
                WPFMessageBox.ShowWarring("请选择配方主信息。", "保存");
                return;
            }

            if (string.IsNullOrEmpty(detail.FORMULA_DETAIL_NAME))
            {
                WPFMessageBox.ShowWarring("请输入配方明细名称。", "保存");
                return;
            }

            #endregion

            if (string.IsNullOrEmpty(detail.PKNO)) //新增
            {
                detail.PKNO = CBaseData.NewGuid();

                ws.UseService(s => s.AddFmsActionFormulaDetail(detail));

                //重新刷新数据
                List <FmsActionFormulaDetail> details =
                    ws.UseService(s => s.GetFmsActionFormulaDetails($"FORMULA_CODE = {main.FORMULA_CODE} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.PROCESS_INDEX)
                    .ToList();
                gridItem.ItemsSource = details;
            }
            else  //修改
            {
                ws.UseService(s => s.UpdateFmsActionFormulaDetail(detail));
            }
            //提示保存成功

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 27
0
        public ActionFomulaDetail_In()
        {
            InitializeComponent();

            GetMainData();

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
        }
Esempio n. 28
0
        public AllocationMang()
        {
            InitializeComponent();

            GetMainData();

            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
        }
Esempio n. 29
0
        private void BtnItemSave_Click(object sender, RoutedEventArgs e)
        {
            WmsAreaInfo m_WmsAreaInfo = tvMain.SelectedItem as WmsAreaInfo;

            if ((m_WmsAreaInfo == null) || (string.IsNullOrEmpty(m_WmsAreaInfo.PKNO)))
            {
                return;
            }
            WmsAllocationInfo m_AllocationInfo = gbItem.DataContext as WmsAllocationInfo;

            if (m_AllocationInfo == null)
            {
                return;
            }

            #region  校验

            if (string.IsNullOrEmpty(m_AllocationInfo.ALLOCATION_NAME))
            {
                System.Windows.Forms.MessageBox.Show("请输入货位名称。", "保存", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #endregion

            if (string.IsNullOrEmpty(m_AllocationInfo.PKNO)) //新增
            {
                m_AllocationInfo.PKNO             = Guid.NewGuid().ToString("N");
                m_AllocationInfo.CREATED_BY       = CBaseData.LoginName;
                m_AllocationInfo.CREATION_DATE    = DateTime.Now;
                m_AllocationInfo.LAST_UPDATE_DATE = DateTime.Now;

                ws.UseService(s => s.AddWmsAllocationInfo(m_AllocationInfo));

                //重新刷新数据
                List <WmsAllocationInfo> mAllocationInfos =
                    ws.UseService(s => s.GetWmsAllocationInfos($"AREA_PKNO = {m_WmsAreaInfo.PKNO} AND USE_FLAG >= 0"))
                    .OrderBy(c => c.CREATION_DATE)
                    .ToList();
                gridItem.ItemsSource = mAllocationInfos;
            }
            else  //修改
            {
                m_AllocationInfo.UPDATED_BY       = CBaseData.LoginName;
                m_AllocationInfo.LAST_UPDATE_DATE = DateTime.Now;
                ws.UseService(s => s.UpdateWmsAllocationInfo(m_AllocationInfo));
            }
            //提示保存成功

            gbItem.IsCollapsed = true;
            gbItem.Visibility  = Visibility.Collapsed;
            BindHelper.SetDictDataBindingGridItem(gbItem, gridItem);
        }
Esempio n. 30
0
        private Task FirstBatch(List <QuoteRevenue> list)
        {
            var groupedQuoteRevenueList = list
                                          .GroupBy(q => q.QuoteNumber, (quoteNumber, quoteRevenues) => new
            {
                key   = quoteNumber,
                value = quoteRevenues
            });

            using (TransactionScope scope = new TransactionScope())
            {
                foreach (var group in groupedQuoteRevenueList)
                {
                    string  quoteNumber = group.key.Trim();
                    Project dbProject   = _projectRepository.GetBy(p => p.QuoteNumber == quoteNumber).FirstOrDefault();

                    if (dbProject == null)
                    {
                        Project project = BindHelper.GetProject(group.value);
                        Order[] orders  = BindHelper.GetOrders(group.value, project.Id, project.QuoteNumber);

                        _projectRepository.Add(project);
                        if (orders == null || orders.Length == 0)
                        {
                        }
                        else
                        {
                            _orderRepository.BatchAdd(orders);
                        }
                        _orderRepository.Save();
                        scope.Complete();
                    }
                    else
                    {
                        float   totalBooking = 0;
                        Order[] orders       = BindHelper.GetOrders(group.value, dbProject.Id, dbProject.QuoteNumber);
                        if (orders == null || orders.Length == 0)
                        {
                            throw new ExcelContentNotMatchBusinessRuleException(quoteNumber);
                        }
                        totalBooking = dbProject.TotalBooking + orders.Sum(o => o.Amount);

                        _projectRepository.Update(p => p.QuoteNumber == quoteNumber, q => new Project {
                            TotalBooking = totalBooking
                        });
                        _orderRepository.BatchAdd(orders);
                    }
                }
                _orderRepository.Save();
                scope.Complete();
            }
            return(Task.CompletedTask);
        }
Esempio n. 31
0
 private void BindFields()
 {
     BindHelper.Bind(txtName, "Text", project, "Name");
     BindHelper.Bind(txtAuthor, "Text", project, "Author");
     BindHelper.Bind(txtVersion, "Text", project, "Version");
     BindHelper.Bind(txtOutput, "Text", project, "Output");
     BindHelper.Bind(txtCopy, "Text", project, "Copyright");
     BindHelper.Bind(txtSource, "Text", project, "SourceDir");
     BindHelper.Bind(txtDocs, "Text", project, "DocDir");
     BindHelper.Bind(txtBuild, "Text", project, "MinDir");
     BindHelper.Bind(cbSource, "Checked", project, "Source");
     BindHelper.Bind(cbDoc, "Checked", project, "Doc");
     BindHelper.Bind(cbBuild, "Checked", project, "Minify");
 }