예제 #1
0
 public void BindData(object obj)
 {
     //vSupplierBindingSource.DataSource = clientFactory.GetData<VSupplier>();
     goodsBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <Goods>(o => o.Type == (int)GoodsBigType.Mold);
     moldAllotList = BLLFty.Create <BaseBLL>().GetListBy <MoldAllot>(null);
     GetMoldAllotDataSource();
 }
예제 #2
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Department obj = departmentBindingSource.DataSource as Department;
         //添加
         if (dept == null)
         {
             dept         = obj;
             dept.ID      = Guid.NewGuid();
             dept.AddTime = DateTime.Now;
             BLLFty.Create <DepartmentBLL>().Insert(dept);
         }
         else//修改
         {
             BLLFty.Create <DepartmentBLL>().Update(obj);
         }
         //CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         //CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         XtraMessageBox.Show(ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #3
0
        private void gridView_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            GridView         view = sender as GridView;
            List <MoldAllot> list = ((BindingSource)view.DataSource).DataSource as List <MoldAllot>;

            if (e.IsGetData && list != null && list.Count > 0)
            {
                Goods goods = BLLFty.Create <BaseBLL>().GetListBy <Goods>(o => o.ID == list[e.ListSourceRowIndex].GoodsID).FirstOrDefault();
                if (goods != null)
                {
                    if (e.Column == colName)
                    {
                        e.Value = goods.Name;
                    }
                    if (e.Column == colSPEC)
                    {
                        e.Value = goods.SPEC;
                    }
                    if (e.Column == colUnit)
                    {
                        e.Value = goods.Unit;
                    }
                    if (e.Column == colRemark)
                    {
                        e.Value = goods.Remark;
                    }
                }
            }
        }
예제 #4
0
 List <TypesList> types;   //类型列表
 public UsersEditPage(Object obj)
 {
     InitializeComponent();
     BindData();
     if (MainForm.usersInfo.AttPrivilege == 1)
     {
         lciPassword.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         lciWageType.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         lciWages.Visibility        = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         lciSchClassWage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
         lciTimeWage.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
     }
     else
     {
         lciPassword.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         lciWageType.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         lciWages.Visibility        = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         lciSchClassWage.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
         lciTimeWage.Visibility     = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
     }
     types = BLLFty.Create <BaseBLL>().GetListByNoTracking <TypesList>(null);
     //typesListBindingSource.DataSource = types.FindAll(o => o.Type == TypesListConstants.PrivilegeType);
     //wageTypeBindingSource.DataSource = types.FindAll(o => o.Type == TypesListConstants.WageType);
     if (obj == null)
     {
         user            = new UsersInfo();
         user.AttEnabled = true;
         usersInfoBindingSource.DataSource = user;
     }
     else
     {
         usersInfoBindingSource.DataSource = user = (UsersInfo)obj;
         //user = (UsersInfo)obj;
     }
 }
예제 #5
0
파일: LoginForm.cs 프로젝트: xubinlee/WMS
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (Invalid())
            {
                return;
            }
            UsersInfo  user = BLLFty.Create <BaseBLL>().GetListBy <UsersInfo>(o => o.Code.Equals(txtCode.Text.Trim())).FirstOrDefault();
            Department dept = new Department();

            if (deptList.Count > 0)
            {
                Guid deptID = Guid.Parse(lueDept.EditValue.ToString());
                dept = deptList.FirstOrDefault(o => o.ID.Equals(deptID));
            }
            //string msg = string.Empty;
            if (user.Password != txtPassword.Text.Trim())
            {
                dxErrorProvider1.SetError(txtPassword, "密码不正确。");
                //XtraMessageBox.Show("密码不正确。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPassword.Focus();
                txtPassword.SelectAll();
            }
            else
            {
                Utility.ConfigAppSettings.SetValue("User", user.Code);
                MainForm.usersInfo  = user;
                MainForm.department = dept;
                this.DialogResult   = System.Windows.Forms.DialogResult.OK;
            }
        }
예제 #6
0
파일: LoginForm.cs 프로젝트: xubinlee/WMS
 public void BindData()
 {
     usersInfoBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <UsersInfo>(o => o.IsDel == false && !string.IsNullOrEmpty(o.Password));
     deptList = BLLFty.Create <BaseBLL>().GetListBy <Department>(o => o.IsDel == false);
     deptBindingSource.DataSource = deptList;
     txtCode.EditValue            = Utility.ConfigAppSettings.GetValue("User");
 }
예제 #7
0
 private void schedulerStorage_AppointmentsChanged(object sender, PersistentObjectsEventArgs e)
 {
     BLLFty.Create <BaseBLL>().UpdateByBulk <Appointments>(GetAppointmentsList(e.Objects));
     //刷新数据
     clientFactory.DataPageRefresh <Appointments>();
     //clientFactory.DataPageRefresh<VAppointments>();
 }
예제 #8
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Hashtable hasGoods = new Hashtable();
         if (customerSLSalePriceList == null)
         {
             CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), string.Format("请完整填写{0}", dpBOM.Text.Trim()));
             return(false);
         }
         //foreach (MoldAllot item in supplierMoldAllotList)
         //{
         //    item.SupplierID = focusedID;
         //}
         for (int i = customerSLSalePriceList.Count - 1; i >= 0; i--)
         {
             if (customerSLSalePriceList[i].GoodsID == Guid.Empty || customerSLSalePriceList[i].Price == 0)
             {
                 customerSLSalePriceList.RemoveAt(i);
                 continue;
             }
             if (hasGoods[customerSLSalePriceList[i].GoodsID] == null)
             {
                 hasGoods.Add(customerSLSalePriceList[i].GoodsID, customerSLSalePriceList[i]);
             }
             else
             {
                 CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "不能重复选择货品。");
                 return(false);
             }
             customerSLSalePriceList[i].CustomerID = focusedID;
             //if (customerSLSalePriceList[i].PCS == 0)
             //    customerSLSalePriceList[i].PCS = 1;
         }
         //添加
         if (addNew)
         {
             BLLFty.Create <CustomerSLSalePriceBLL>().Insert(customerSLSalePriceList);
         }
         else//修改
         {
             BLLFty.Create <CustomerSLSalePriceBLL>().Update(focusedID, customerSLSalePriceList);
         }
         addNew = false;
         //DataQueryPageRefresh();
         CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #9
0
        /// <summary>
        /// 刷新所有界面
        /// </summary>
        /// <typeparam name="T">类型</typeparam>
        /// <returns></returns>
        public virtual List <T> DataPageRefresh <T>() where T : class, new()
        {
            List <T> list = BLLFty.Create <BaseBLL>().GetListBy <T>(null);

            foreach (KeyValuePair <String, IItemDetail> kvp in itemDetailList)
            {
                kvp.Value.BindData(list);
            }
            return(list);
        }
예제 #10
0
 /// <summary>
 /// 刷新查询界面
 /// </summary>
 void PageRefresh()
 {
     MainForm.dataSourceList[typeof(List <StaffSchClass>)]  = BLLFty.Create <StaffSchClassBLL>().GetStaffSchClass();
     MainForm.dataSourceList[typeof(List <VStaffSchClass>)] = BLLFty.Create <StaffSchClassBLL>().GetVStaffSchClass();
     BindData();
     if (MainForm.itemDetailList.ContainsKey(MainMenuConstants.StaffAttendance))
     {
         AttendanceSchedulingPage page = MainForm.itemDetailList[MainMenuConstants.StaffAttendance] as AttendanceSchedulingPage;
         page.PageRefresh();
     }
 }
예제 #11
0
 void GetPSDataSource()
 {
     if (winExplorerView.GetFocusedRowCellValue(colID) != null)
     {
         focusedID = new Guid(winExplorerView.GetFocusedRowCellValue(colID).ToString());
         appointmentsBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <Appointments>(o => o.UserID == focusedID);
         picStatus.Visible = false;
         //DataView dv = erpToysDataSet.Appointments.DefaultView;
         //dv.RowFilter = string.Format("UserID='{0}'", focusedID);
         //appointmentsBindingSource.DataSource = dv.ToTable();
     }
 }
예제 #12
0
 public void BindData(object list)
 {
     usersInfoBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListByNoTracking <UsersInfo>(o => o.IsDel == false && !string.IsNullOrEmpty(o.Password));
     dsPermission = IListDataSet.ToDataSet <Permission>(BLLFty.Create <BaseBLL>().GetListBy <Permission>(o => o.UserID == MainForm.usersInfo.ID));
     if (dsPermission.Tables[0].Rows.Count > 0)
     {
         cuTreeListPermission.DataSource                 = dsPermission.Tables[0];
         cuTreeListPermission.CheckedStateFieldName      = "CheckBoxState";
         cuTreeListPermission.Columns["Caption"].Caption = "功能名称";
         cuTreeListPermission.Columns["Caption"].OptionsColumn.AllowEdit = false;
         cuTreeListPermission.Columns["SerialNo"].Visible      = false;
         cuTreeListPermission.Columns["UserID"].Visible        = false;
         cuTreeListPermission.Columns["CheckBoxState"].Visible = false;
     }
 }
예제 #13
0
 void GetMoldAllotDataSource()
 {
     if (winExplorerView.GetFocusedRowCellValue(colID) != null)
     {
         focusedID     = new Guid(winExplorerView.GetFocusedRowCellValue(colID).ToString());
         moldAllotList = BLLFty.Create <BaseBLL>().GetListBy <MoldAllot>(null);
         if (moldAllotList != null)
         {
             bOMBindingSource.DataSource = supplierMoldAllotList = moldAllotList.FindAll(o => o.SupplierID == focusedID);
         }
         else
         {
             bOMBindingSource.DataSource = supplierMoldAllotList = new List <MoldAllot>();
         }
     }
 }
예제 #14
0
 private void schedulerStorage_AppointmentsInserted(object sender, PersistentObjectsEventArgs e)
 {
     foreach (Appointment apt in e.Objects)
     {
         Appointments dbApt = (Appointments)apt.GetSourceObject(this.schedulerStorage);
         if (dbApt == null || dbApt.UserID == null || dbApt.UserID == Guid.Empty)
         {
             CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "添加失败,请刷新数据后重试。");
             break;
         }
         BLLFty.Create <BaseBLL>().Add <Appointments>(dbApt);
         break;
     }
     //BLLFty.Create<AppointmentsBLL>().Insert(GetAppointmentsList(e.Objects));
     //刷新数据
     clientFactory.DataPageRefresh <Appointments>();
     //clientFactory.DataPageRefresh<VAppointments>();
 }
예제 #15
0
        private void GetTypeList()
        {
            List <Department> depts = BLLFty.Create <BaseBLL>().GetListBy <Department>(null);
            //门店类型
            List <string> list = depts.Select(o => o.Type).Distinct().ToList();

            if (list != null)
            {
                cboType.Properties.Items.Clear();
                list.ForEach(p =>
                {
                    if (p != null)
                    {
                        cboType.Properties.Items.Add(p);
                    }
                });
            }
        }
예제 #16
0
        public void Print()
        {
            #region #showreport
            XtraSchedulerReport1         xr             = new XtraSchedulerReport1();
            SchedulerControlPrintAdapter scPrintAdapter =
                new SchedulerControlPrintAdapter(this.schedulerControl1);
            xr.SchedulerAdapter = scPrintAdapter;
            xr.CreateDocument(true);
            xr.paramUserName.Value = BLLFty.Create <BaseBLL>().GetListBy <UsersInfo>(o =>
                                                                                     o.ID == focusedID).FirstOrDefault().Name;
            //xr.paramAMT.Value = ((List<VAppointments>)MainForm.dataSourceList[typeof(VAppointments)]).FindAll(o =>
            //    o.UserID == focusedID && o.日期.Value.Month == dateNavigator.DateTime.Month).Sum(o => o.当班金额);

            using (ReportPrintTool printTool = new ReportPrintTool(xr))
            {
                printTool.ShowRibbonPreviewDialog();
            }
            #endregion #showreport
        }
예제 #17
0
        void GetPermission(object sender)
        {
            UsersInfo user = ((DevExpress.XtraGrid.Views.Layout.LayoutView)sender).GetFocusedRow() as UsersInfo;

            if (user != null)
            {
                dsPermission = IListDataSet.ToDataSet <Permission>(BLLFty.Create <BaseBLL>().GetListBy <Permission>(o => o.UserID == user.ID));
                cuTreeListPermission.DataSource = dsPermission.Tables[0];
                cuTreeListPermission.ExpandAll();
                foreach (TreeListNode node in cuTreeListPermission.GetNodeList())
                {
                    DataRowView drv = cuTreeListPermission.GetDataRecordByNode(node) as DataRowView;
                    if (drv != null)
                    {
                        node.Checked = (bool)drv["CheckBoxState"];
                    }
                }
                buttonPermissionBindingSource.DataSource = btnPermissionList = BLLFty.Create <BaseBLL>().GetListBy <ButtonPermission>(o => o.UserID == user.ID);
            }
        }
예제 #18
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Department obj = departmentBindingSource.DataSource as Department;
         //obj.Code = Rexlib.GetSpellCode(obj.Name);
         //添加
         if (dept == null)
         {
             dept         = obj;
             dept.ID      = Guid.NewGuid();
             dept.AddTime = DateTime.Now;
             List <Department> deptList = BLLFty.Create <BaseBLL>().GetListBy <Department>(null);
             if (deptList.Exists(o => o.Name == dept.Code))
             {
                 XtraMessageBox.Show("该门店已经存在,不能重复添加。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(false);
             }
             BLLFty.Create <BaseBLL>().Add <Department>(dept);
         }
         else//修改
         {
             BLLFty.Create <BaseBLL>().Modify <Department>(obj);
         }
         //CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         //CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         XtraMessageBox.Show(ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #19
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Supplier obj = supplierBindingSource.DataSource as Supplier;
         obj.Code = Rexlib.GetSpellCode(obj.Name);
         //添加
         if (supplier == null)
         {
             supplier         = obj;
             supplier.ID      = Guid.NewGuid();
             supplier.AddTime = DateTime.Now;
             bool exists = BLLFty.Create <BaseBLL>().GetListByNoTracking <Supplier>(o => o.ID != obj.ID && o.Name.Equals(supplier.Name)).Any();
             if (exists)
             {
                 XtraMessageBox.Show("该供应商已经存在,不能重复添加。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(false);
             }
             BLLFty.Create <BaseBLL>().Add <Supplier>(supplier);
         }
         else//修改
         {
             BLLFty.Create <BaseBLL>().Modify <Supplier>(obj);
         }
         //CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         //CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         XtraMessageBox.Show(ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #20
0
        /// <summary>
        /// 从缓存获取数据,缓存没有再从数据库取
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <returns></returns>
        //public virtual List<T> GetData<T>() where T : class, new()
        //{
        //    return BLLFty.Create<BaseBLL>().GetListBy<T>(null);
        //    //List<T> list = new List<T>();
        //    //if (dataSourceList.ContainsKey(typeof(T)))
        //    //{
        //    //    list = (List<T>)dataSourceList[typeof(T)];
        //    //}
        //    //else
        //    //{
        //    //    list = BLLFty.Create<BaseBLL>().GetListBy<T>(null);
        //    //    dataSourceList.Add(typeof(T), list);
        //    //}
        //    //return list;
        //}

        /// <summary>
        /// 从缓存获取数据,缓存没有再从数据库取(返回List不需要修改或删除)
        /// </summary>
        /// <typeparam name="T">实体类型</typeparam>
        /// <returns></returns>
        //public virtual List<T> GetDataByNoTracking<T>() where T : class, new()
        //{
        //    return BLLFty.Create<BaseBLL>().GetListByNoTracking<T>(null);
        //    //List<T> list = new List<T>();
        //    //if (dataSourceList.ContainsKey(typeof(T)))
        //    //{
        //    //    list = (List<T>)dataSourceList[typeof(T)];
        //    //}
        //    //else
        //    //{
        //    //    list = BLLFty.Create<BaseBLL>().GetListByNoTracking<T>(null);
        //    //    dataSourceList.Add(typeof(T), list);
        //    //}
        //    //return list;
        //}

        /// <summary>
        /// 刷新所有界面(直接从数据库取数)
        /// </summary>
        /// <param name="entityName">实体类型名称</param>
        /// <param name="filter">查询条件</param>
        /// <returns></returns>
        public virtual IList DataPageRefresh(String entityName, String filter)
        {
            IList list = null;
            Type  type = Reflect(entityName);

            if (type != null)
            {
                list = BLLFty.Create <BaseBLL>().ExecuteQuery(type, filter);
                //if (dataSourceList.ContainsKey(type))
                //{
                //    dataSourceList[type] = list;
                //}
                //else
                //{
                //    dataSourceList.Add(type, list);
                //}
                foreach (KeyValuePair <String, IItemDetail> kvp in itemDetailList)
                {
                    kvp.Value.BindData(list);
                }
            }
            return(list);
        }
예제 #21
0
 private void btnNext_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtBillNo.Text.Trim()))
     {
         List <AttWageBillHd> bills = BLLFty.Create <BaseBLL>().GetListBy <AttWageBillHd>(null).OrderBy(o => o.BillNo).ToList();
         for (int i = 0; i < bills.Count; i++)
         {
             if (bills[i].BillNo.Equals(txtBillNo.Text.Trim()))
             {
                 if (i + 1 < bills.Count)
                 {
                     BindData(bills[i + 1].ID);
                     btnPrev.Enabled = true;
                     if (i + 1 == bills.Count - 1)
                     {
                         btnNext.Enabled = false;
                     }
                     if (bills[i + 1].Status == 0)
                     {
                         MainForm.itemDetailPageList[MainMenuEnum.AttWageBill.ToString()].setNavButtonStatus(MainForm.mainMenuList[MainMenuEnum.AttWageBill.ToString()], ButtonType.btnSave);
                     }
                     else
                     {
                         MainForm.itemDetailPageList[MainMenuEnum.AttWageBill.ToString()].setNavButtonStatus(MainForm.mainMenuList[MainMenuEnum.AttWageBill.ToString()], ButtonType.btnAudit);
                     }
                     break;
                 }
                 else
                 {
                     btnPrev.Enabled = true;
                     btnNext.Enabled = false;
                     break;
                 }
             }
         }
     }
 }
예제 #22
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         bool flag = false;
         if (dsPermission == null)
         {
             CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "该用户没有操作权限");
             flag = true;
         }
         if (btnPermissionList == null)
         {
             CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "该用户没有按钮控制权限");
             flag = true;
         }
         if (flag)
         {
             return(false);
         }
         BLLFty.Create <PermissionBLL>().Update(IListDataSet.DataSetToIList <Permission>(dsPermission, 0).ToList(), btnPermissionList);
         //vStockOutBillDtlForPrintBindingSource.DataSource = BLLFty.Create<StockOutBillBLL>().GetStockOutBillDtlForPrint(hd.ID);
         //gvBillDtlForPrint.BestFitColumns();
         clientFactory.DataPageRefresh <Permission>().OrderBy(o => o.SerialNo);
         CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #23
0
 public void BindData()
 {
     goodsTypeBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <GoodsType>(null);
     packagingBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <Packaging>(null);
 }
예제 #24
0
 public void BindData()
 {
     departmentBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <Department>(null);
 }
예제 #25
0
        public bool Save()
        {
            try
            {
                this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
                UsersInfo obj = usersInfoBindingSource.DataSource as UsersInfo;
                if (pePhoto.EditValue == System.DBNull.Value)
                {
                    obj.Photo = null;
                }
                else
                {
                    if (pePhoto.EditValue is byte[])
                    {
                        obj.Photo = (byte[])pePhoto.EditValue;
                    }
                    else
                    {
                        obj.Photo = ImageHelper.MakeBuff((Image)pePhoto.EditValue);
                    }
                }
                Expression <Func <UsersInfo, bool> > whereLambda = o => o.ID != obj.ID && o.AttCardnumber.Equals(obj.AttCardnumber) && o.IsDel == false;
                List <UsersInfo> users = BLLFty.Create <BaseBLL>().GetListByNoTracking <UsersInfo>(whereLambda);
                if (users.Count > 0 && user.ID != obj.ID && !string.IsNullOrEmpty(obj.AttCardnumber) && user.AttCardnumber == obj.AttCardnumber)
                {
                    XtraMessageBox.Show(string.Format("考勤卡号:{0}已经存在,不允许添加重复考勤卡号。", obj.AttCardnumber), "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return(false);
                }
                //添加
                //if (user == null)
                if (user.ID == null || user.ID == Guid.Empty)
                {
                    //user = obj;
                    user.ID = Guid.NewGuid();

                    //添加功能权限信息
                    List <Permission>       pList   = new List <Permission>();
                    List <ButtonPermission> btnList = new List <ButtonPermission>();
                    foreach (MainMenu menu in MainForm.AllMainMenuList)
                    {
                        Permission p = new Permission();
                        p.ID = menu.SerialNo;
                        string no = menu.SerialNo.ToString().Trim();
                        if (menu.ParentID == null)
                        {
                            p.ParentID = 0;
                        }
                        else if (no.Length > 2)
                        {
                            p.ParentID = int.Parse(no.Substring(0, no.Length - 2));
                        }
                        p.SerialNo = menu.SerialNo;
                        p.UserID   = user.ID;
                        p.Caption  = menu.Caption;
                        //p.CheckBoxState = false;
                        // 由于不开放权限设置功能,暂时新增用户时分配所有权限
                        p.CheckBoxState = true;
                        pList.Add(p);
                    }
                    //添加按钮权限信息
                    foreach (ButtonType btn in Enum.GetValues(typeof(ButtonType)))
                    {
                        ButtonPermission btnP = new ButtonPermission();
                        btnP.UserID  = user.ID;
                        btnP.Name    = btn.ToString();
                        btnP.Caption = EnumHelper.GetDescription <ButtonType>(btn, false);
                        //btnP.CheckBoxState = false;
                        // 由于不开放权限设置功能,暂时新增用户时分配所有权限
                        btnP.CheckBoxState = true;
                        btnList.Add(btnP);
                    }
                    BLLFty.Create <UsersInfoBLL>().Insert(user, pList, btnList);
                }
                else
                {
                    BLLFty.Create <BaseBLL>().Modify <UsersInfo>(obj);
                }
                //CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
                return(true);
            }
            catch (Exception ex)
            {
                //if (ex.HResult == -2146232060)  //违反了PRIMARY KEY约束
                //    XtraMessageBox.Show(string.Format("账号:{0}已经存在,请重新设置账号。", user.Code), "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //else
                XtraMessageBox.Show(ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            finally
            {
                this.Cursor = System.Windows.Forms.Cursors.Default;
            }
        }
예제 #26
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Hashtable            hasSch  = new Hashtable();
         List <StaffSchClass> sscList = new List <StaffSchClass>();
         for (int i = staffSchClassList.Count - 1; i >= 0; i--)
         {
             //if (staffSchClassList[i].UserID == null || staffSchClassList[i].UserID == Guid.Empty)
             //{
             //    XtraMessageBox.Show("请选择排班人员。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             //    return false;
             //}
             if (staffSchClassList[i].SchClassID == null || staffSchClassList[i].SchClassID == Guid.Empty)
             {
                 XtraMessageBox.Show("时段名称不能为空。", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return(false);
             }
             if (hasSch[staffSchClassList[i].DeptID.ToString() + staffSchClassList[i].SchClassID.ToString()] == null)
             {
                 hasSch.Add(staffSchClassList[i].DeptID.ToString() + staffSchClassList[i].SchClassID.ToString(), staffSchClassList[i]);
             }
             else
             {
                 CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), "时段名称不能重复。");
                 return(false);
             }
             staffSchClassList[i].SchSerialNo = i;
             StaffSchClass ssc = ((List <StaffSchClass>)MainForm.dataSourceList[typeof(List <StaffSchClass>)]).FirstOrDefault(o =>
                                                                                                                              o.DeptID == focused && o.SchClassID == staffSchClassList[i].SchClassID);
             if (ssc == null)
             {
                 ssc    = new StaffSchClass();
                 ssc.ID = Guid.NewGuid();
             }
             ssc.DeptID      = focused;
             ssc.SchClassID  = staffSchClassList[i].SchClassID;
             ssc.SchSerialNo = staffSchClassList[i].SchSerialNo;
             sscList.Add(ssc);
             //foreach (UsersInfo user in focusedUsers)
             //{
             //    StaffSchClass ssc = ((List<StaffSchClass>)MainForm.dataSourceList[typeof(List<StaffSchClass>)]).FirstOrDefault(o =>
             //        o.UserID == user.ID && o.SchClassID == staffSchClassList[i].SchClassID);
             //    if (ssc==null)
             //    {
             //        ssc = new StaffSchClass();
             //        ssc.ID = Guid.NewGuid();
             //    }
             //    ssc.UserID = user.ID;
             //    ssc.SchClassID = staffSchClassList[i].SchClassID;
             //    ssc.SchSerialNo = staffSchClassList[i].SchSerialNo;
             //    sscList.Add(ssc);
             //}
         }
         BLLFty.Create <StaffSchClassBLL>().Update(sscList, focused);
         //addNew = false;
         //刷新数据
         PageRefresh();
         CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         return(true);
     }
     catch (Exception ex)
     {
         CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
예제 #27
0
        void GetTotal()
        {
            ManHour = seManHour.Value;
            decimal wages     = 0;
            decimal weight    = 0;
            decimal nWeight   = 0;
            decimal cycle     = 0;
            int     planYield = 0;
            int     yielded   = 0;

            if (!string.IsNullOrEmpty(txtWeight.Text))
            {
                weight = decimal.Parse(txtWeight.Text);
            }
            if (!string.IsNullOrEmpty(txtNWeight.Text))
            {
                nWeight = decimal.Parse(txtNWeight.Text);
            }
            if (!string.IsNullOrEmpty(txtCycle.Text))
            {
                cycle = decimal.Parse(txtCycle.Text);
            }
            if (CheckedRow != null)
            {
                if (ManHour == ((WageDesign)CheckedRow).ManHour)
                {
                    wages = ((WageDesign)CheckedRow).Wages.Value;
                }
                else
                {
                    //一班工时小于6(比如停电),工价按公班价格算
                    WageDesign obj = BLLFty.Create <BaseBLL>().GetListBy <WageDesign>(o => o.Name.Contains("公班")).FirstOrDefault();
                    if (obj != null)
                    {
                        wages = obj.Wages.Value;
                    }
                }
                if (cycle != 0)
                {
                    planYield = Convert.ToInt32(ManHour * 3600 / cycle * ((WageDesign)CheckedRow).ErrorRate);
                    txtPlanYield.EditValue = planYield;
                }
                if (nWeight != 0)
                {
                    yielded = Convert.ToInt32(weight * 500 / nWeight);
                    txtYielded.EditValue = yielded;
                }
                if (((WageDesign)CheckedRow).Name.Contains("其他事项"))
                {
                    lueGoods.Enabled   = false;
                    txtWeight.Enabled  = false;
                    seManHour.Enabled  = false;
                    txtNWeight.Enabled = false;
                    txtCycle.Enabled   = false;
                    tbSubject.Enabled  = true;
                    lueGoods.Text      = null;
                    txtWeight.Text     = null;
                    txtNWeight.Text    = null;
                    txtCycle.Text      = null;
                }
                else
                {
                    lueGoods.Enabled  = true;
                    seManHour.Enabled = true;
                    tbSubject.Enabled = false;
                    if (((WageDesign)CheckedRow).Name.Contains("公班"))
                    {
                        tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages / ((WageDesign)CheckedRow).ManHour * ManHour), 2).ToString();
                        tbSubject.EditValue  = "(公班)" + goodsName;
                    }
                    else if (((WageDesign)CheckedRow).Name.Contains("两") || ((WageDesign)CheckedRow).Name.Contains("二") || ((WageDesign)CheckedRow).Name.Contains("2"))
                    {
                        if (ManHour == ((WageDesign)CheckedRow).ManHour)
                        {
                            tbLocation.EditValue = ((WageDesign)CheckedRow).Wages.Value.ToString();
                        }
                        else
                        {
                            if (ManHour * 2 > ((WageDesign)CheckedRow).ManHour)//56+(工时*2-公班工时)*(80-56)/6
                            {
                                tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages + (ManHour * 2 - ((WageDesign)CheckedRow).ManHour) * ((((WageDesign)CheckedRow).Wages - wages) / ((WageDesign)CheckedRow).ManHour)), 2).ToString();
                            }
                            else//56/6*工时*2
                            {
                                tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages / ((WageDesign)CheckedRow).ManHour * ManHour) * 2, 2).ToString();
                            }
                        }
                        tbSubject.EditValue = "(两台机器)" + goodsName;
                    }
                    else if (((WageDesign)CheckedRow).Name.Contains("三") || ((WageDesign)CheckedRow).Name.Contains("3"))
                    {
                        if (ManHour == ((WageDesign)CheckedRow).ManHour)
                        {
                            tbLocation.EditValue = ((WageDesign)CheckedRow).Wages.Value.ToString();
                        }
                        else
                        {
                            if (ManHour * 3 > ((WageDesign)CheckedRow).ManHour)//56+(工时*3-公班工时)*(80-56)/6
                            {
                                tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages + (ManHour * 3 - ((WageDesign)CheckedRow).ManHour) * ((((WageDesign)CheckedRow).Wages - wages) / ((WageDesign)CheckedRow).ManHour)), 2).ToString();
                            }
                            else//56/6*工时*2
                            {
                                tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages / ((WageDesign)CheckedRow).ManHour * ManHour) * 3, 2).ToString();
                            }
                        }
                        tbSubject.EditValue = "(三台机器)" + goodsName;
                    }
                    else
                    {
                        if (ManHour == ((WageDesign)CheckedRow).ManHour)
                        {
                            tbLocation.EditValue = decimal.Round(Convert.ToDecimal((yielded - planYield) * ((WageDesign)CheckedRow).Price + wages), 2).ToString();
                        }
                        else
                        {
                            tbLocation.EditValue = decimal.Round(Convert.ToDecimal(wages / ((WageDesign)CheckedRow).ManHour * ManHour), 2).ToString();
                        }
                        tbSubject.EditValue = goodsName;
                    }
                }
            }
        }
예제 #28
0
 /// <summary>
 /// Add your code to obtain a custom field value and fill the editor with data.
 /// </summary>
 public override void LoadFormData(DevExpress.XtraScheduler.Appointment appointment)
 {
     goodsBindingSource.DataSource      = BLLFty.Create <BaseBLL>().GetListBy <Goods>(o => o.Type == (int)GoodsBigType.Mold);
     wageDesignBindingSource.DataSource = BLLFty.Create <BaseBLL>().GetListBy <WageDesign>(null);
     //if (appointment.CustomFields["UniqueID"] != null)
     //    prevApt = ((List<Appointments>)MainForm.dataSourceList[typeof(Appointments)]).FirstOrDefault(o => o.UniqueID == (Int64)appointment.CustomFields["UniqueID"]);
     if (appointment.CustomFields["GoodsID"] == null)
     {
         lueGoods.EditValue = null;
     }
     else
     {
         goodsID            = new Guid(appointment.CustomFields["GoodsID"].ToString());
         lueGoods.EditValue = goodsID;
     }
     //if (prevApt != null)
     //{
     //    if (prevApt.GoodsID == null)
     //        CheckedRowIndex = 0;
     //    else
     //        goodsID = prevApt.GoodsID.Value;
     //    ManHour = prevApt.ManHour;
     //    weight = prevApt.Weight;
     //    if (prevApt.WageDesignID == null)
     //        CheckedRowIndex = 0;
     //    else
     //    {
     //        WageDesignID = prevApt.WageDesignID.Value.ToString();
     //        CheckedRow = ((List<WageDesign>)MainForm.dataSourceList[typeof(WageDesign)]).Find(o => o.ID == new Guid(WageDesignID));
     //    }
     //    if (!string.IsNullOrEmpty(prevApt.Location))
     //        tbLocation.EditValue = decimal.Parse(prevApt.Location);
     //    lueGoods.EditValue = goodsID;
     //    seManHour.EditValue = ManHour;
     //    txtWeight.EditValue = weight;
     //}
     //else
     //    CheckedRowIndex = 0;
     if (appointment.CustomFields["ManHour"] != null)
     {
         ManHour = decimal.Parse(appointment.CustomFields["ManHour"].ToString());
     }
     seManHour.EditValue = ManHour;
     if (appointment.CustomFields["Weight"] != null)
     {
         weight = decimal.Parse(appointment.CustomFields["Weight"].ToString());
     }
     txtWeight.EditValue = weight;
     if (appointment.CustomFields["WageDesignID"] == null)
     {
         CheckedRowIndex = 0;
     }
     else
     {
         WageDesignID = appointment.CustomFields["WageDesignID"].ToString();
         CheckedRow   = BLLFty.Create <BaseBLL>().GetListBy <WageDesign>(o => o.ID == new Guid(WageDesignID)).FirstOrDefault();
     }
     GetTotal();
     if (!string.IsNullOrEmpty(appointment.Location))
     {
         tbLocation.EditValue = decimal.Parse(appointment.Location);
     }
     edtShowTimeAs.SelectedIndex = int.Parse(appointment.StatusKey.ToString());
     //if (appointment.CustomFields["AMT"] != null)
     //{
     //    amt = decimal.Parse(appointment.CustomFields["AMT"].ToString());
     //    tbLocation.EditValue = amt;//AMT可手动修改,所以值以最后保存值为主
     //}
     base.LoadFormData(appointment);
 }
예제 #29
0
 public SchClassPage()
 {
     InitializeComponent();
     schClassBindingSource.DataSource = schClassList = BLLFty.Create <BaseBLL>().GetListBy <SchClass>(null);
 }
예제 #30
0
 public bool Save()
 {
     try
     {
         this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
         Goods obj = goodsBindingSource.DataSource as Goods;
         if (!System.IO.Directory.Exists(MainForm.DownloadFilePath))
         {
             System.IO.Directory.CreateDirectory(MainForm.DownloadFilePath);
         }
         string fileName = MainForm.DownloadFilePath + String.Format("{0}.jpg", obj.Code);
         if (pePic.EditValue == System.DBNull.Value)
         {
             obj.Pic = null;
         }
         else
         {
             if (pePic.EditValue is Binary)
             {
                 obj.Pic = ImageHelper.MakeBuff(ImageHelper.GetReducedImage(ImageHelper.BinaryToImage((Binary)pePic.EditValue), 24, 24));
             }
             else
             {
                 ((Image)pePic.EditValue).Save(fileName);
                 //FtpUpDown ftpUpDown = new FtpUpDown(MainForm.ServerUrl, MainForm.ServerUserName, MainForm.ServerPassword);
                 string error = string.Empty;
                 //bool flag = ftpUpDown.Upload(fileName, out error);
                 //if (flag == false)
                 //{
                 //    XtraMessageBox.Show("保存失败。\r\n原因:图片上传失败\r\n"+error, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 //    return false;
                 //}
                 obj.Pic = ImageHelper.MakeBuff(ImageHelper.GetReducedImage((Image)pePic.EditValue, 24, 24));
             }
         }
         if (mainMenu.Name == MainMenuEnum.Goods.ToString())
         {
             obj.Type = 0;
             //if (string.IsNullOrEmpty(obj.SideMark))
             //{
             //    StringBuilder sb = new StringBuilder();
             //    sb.AppendFormat("\r\nITEM NO: {0}\r\n", obj.Code);
             //    sb.Append("QTY:  PCS\r\n");
             //    sb.AppendFormat("G.W: {0} KGS\r\n", obj.GWeight);
             //    sb.AppendFormat("N.W: {0} KGS\r\n", obj.NWeight);
             //    sb.AppendFormat("MEAS: {0} CM\r\n", obj.MEAS);
             //    obj.SideMark = sb.ToString();
             //}
         }
         else
         {
             obj.Type        = MainForm.GoodsBigType;
             obj.PackagingID = Guid.Empty;
             //obj.PCS = 1;
         }
         bool exists = BLLFty.Create <BaseBLL>().GetListByNoTracking <Goods>(o => o.ID != obj.ID && o.Code.Equals(obj.Code)).Any();
         if (exists)
         {
             XtraMessageBox.Show(string.Format("货号:{0}已经存在,不允许添加重复货号。", obj.Code), "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             return(false);
         }
         //if (obj.NWeight == 0)
         //    obj.NWeight = 1;
         if (obj.CavityNumber == 0)
         {
             obj.CavityNumber = 1;
         }
         //添加
         if (goods == null)
         {
             goods         = obj;
             goods.ID      = Guid.NewGuid();
             goods.AddTime = DateTime.Now;
             BLLFty.Create <BaseBLL>().Add <Goods>(goods);
         }
         else
         {
             BLLFty.Create <BaseBLL>().Modify <Goods>(obj);
         }
         //CommonServices.ErrorTrace.SetSuccessfullyInfo(this.FindForm(), "保存成功");
         //保存成功后,显示原来清晰的图片
         if (goods.Pic != null && File.Exists(fileName))
         {
             Image img = Image.FromFile(fileName);
             goods.Pic = ImageHelper.MakeBuff(img);
             img.Dispose();
         }
         return(true);
     }
     catch (Exception ex)
     {
         //CommonServices.ErrorTrace.SetErrorInfo(this.FindForm(), ex.Message);
         XtraMessageBox.Show(ex.Message, "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
     finally
     {
         this.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }