Пример #1
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Press(object sender, EventArgs e)
        {
            try
            {
                AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
                PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                posPrinter1.Print(Commands, (obj, args) =>
                {
                    if (args.isError == true)
                    {
                        this.Toast("Error: " + args.error);
                    }
                    else
                    {
                        this.Toast("打印成功");
                    }
                });
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #2
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void Bind()
 {
     try
     {
         AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
         if (outputDto != null)
         {
             txtAssID.Text          = outputDto.AssId;
             ImgPicture.ResourceID  = outputDto.Image;
             txtNote.Text           = outputDto.Note;
             DatePickerExpiry.Value = outputDto.ExpiryDate;
             txtName.Text           = outputDto.Name;
             txtPrice.Text          = outputDto.Price.ToString();
             txtSpe.Text            = outputDto.Specification;
             txtNote.Text           = outputDto.Note;
             txtPlace.Text          = outputDto.Place;
             txtSN.Text             = outputDto.SN;
             txtUnit.Text           = outputDto.Unit;
             txtVendor.Text         = outputDto.Vendor;
             txtDepart.Text         = outputDto.DepartmentName;
             DepId            = outputDto.DepartmentId;
             btnType.Text     = outputDto.TypeName;
             btnType.Tag      = outputDto.TypeId;
             txtLocation.Text = outputDto.LocationName;
             LocationId       = outputDto.LocationId;
             txtManager.Text  = outputDto.ManagerName;
             ManagerId        = outputDto.Manager;
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Пример #3
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void Bind()
 {
     try
     {
         AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
         if (outputDto != null)
         {
             txtEDate.Text     = outputDto.ExpiryDate.ToString("yyyy-MM-dd");
             txtAssId1.Text    = outputDto.AssId;
             txtBuyDate.Text   = outputDto.BuyDate.ToString("yyyy-MM-dd");
             txtSL.Text        = outputDto.SLName;
             txtName1.Text     = outputDto.Name;
             txtPlace1.Text    = outputDto.Place;
             txtPrice1.Text    = outputDto.Price.ToString();
             txtSN1.Text       = outputDto.SN;
             txtSPE1.Text      = outputDto.Specification;
             txtType.Text      = outputDto.TypeName;
             txtUnit1.Text     = outputDto.Unit;
             txtVendor1.Text   = outputDto.Vendor;
             image2.ResourceID = outputDto.Image;
             txtNote1.Text     = outputDto.Note;
             SLID         = outputDto.SLID;
             TypeId       = outputDto.TypeId;
             txtATID.Text = outputDto.ATID;
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Пример #4
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void Bind()
 {
     try
     {
         AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
         if (outputDto != null)
         {
             txtAssID.Text          = outputDto.AssId;
             ImgPicture.ResourceID  = outputDto.Image;
             txtNote.Text           = outputDto.Note;
             DatePickerExpiry.Value = outputDto.ExpiryDate;
             txtName.Text           = outputDto.Name;
             txtPrice.Text          = outputDto.Price.ToString();
             txtSpe.Text            = outputDto.Specification;
             txtNote.Text           = outputDto.Note;
             txtPlace.Text          = outputDto.Place;
             txtSN.Text             = outputDto.SN;
             txtUnit.Text           = outputDto.Unit;
             txtVendor.Text         = outputDto.Vendor;
             txtATID.Text           = outputDto.ATID;
             btnType.Text           = outputDto.TypeName;
             TypeId     = outputDto.TypeId;
             txtSL.Text = outputDto.SLName;
             SLID       = outputDto.SLID;
             STID       = outputDto.STID;
             WAREID     = outputDto.WAREID;
         }
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Пример #5
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public void Bind()
        {
            try
            {
                ROInputDto ROData = autofacConfig.assRepairOrderService.GetByID(ROID);
                if (ROData != null)
                {
                    lblDealMan.Text  = ROData.call_man;
                    DatePicker.Value = ROData.call_date;
                    lblPrice.Text    = ROData.repair_man;
                    lblContent.Text  = ROData.repair_content;
                    lblNote.Text     = ROData.find_man;
                }
                //coreUser User = autofacConfig.coreUserService.GetUserByID(ROData.HANDLEMAN);
                //lblDealMan.Text = User.USER_NAME;

                AssetsOutputDto assets = autofacConfig.SettingService.GetAssetsByid(ROData.asset_id);

                DataRow row = AssTable.NewRow();
                row["ASSID"]  = assets.AssId;
                row["SN"]     = assets.SN;
                row["STATUS"] = ROData.repair_status;

                AssTable.Rows.Add(row);
                //AssIdList.Add(sn);

                //foreach (AssRepairOrderRow Row in ROData.Rows)
                //{
                //    Assets assets = autofacConfig.orderCommonService.GetAssetsByID(Row.ASSID);
                //    if (Row.STATUS == 0)
                //    {
                //        tableAssets.Rows.Add(Row.ASSID, assets.NAME, assets.IMAGE, Row.SN, "等待修");
                //    }
                //    else
                //    {
                //        tableAssets.Rows.Add(Row.ASSID, assets.NAME, assets.IMAGE, Row.SN, "维修完毕");
                //    }
                //}

                if (AssTable.Rows.Count > 0)
                {
                    BindListView();
                }

                //if (Client.Session["Role"].ToString() == "SMOSECUser") plButton.Visible = false;
                //如果维修单已完成,则隐藏维修单处理按钮
                if (ROData.repair_status != "等待修")
                {
                    plButton.Visible = false;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #6
0
        /// <summary>
        /// 点击ActionButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAssets_ActionButtonPress(object sender, ActionButtonPressEventArgs e)
        {
            try
            {
                switch (e.Index)
                {
                case 0:         //资产调拨
                    //调拨
                    frmAssTransferRows frmT = new frmAssTransferRows();
                    this.Form.Show(frmT);
                    break;

                case 1:
                    //资产打印
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);
                        PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                        //Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "E2000017320082231027BD"));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                        Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                        posPrinter1.Print(Commands, (obj, args) =>
                        {
                            if (args.isError == true)
                            {
                                this.Toast("Error: " + args.error);
                            }
                            else
                            {
                                this.Toast("打印成功");
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #7
0
        private void Bind()
        {
            try
            {
                AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
//                txtNote.Text = outputDto.Note;
                txtEDate.Text = outputDto.ExpiryDate.ToString("yyyy-MM-dd");
//                txtName.Text = outputDto.Name;
//                txtPrice.Text = outputDto.Price.ToString();
//                txtSpe.Text = outputDto.Specification;
                txtAssId1.Text = outputDto.AssId;
//                ImgPicture.ResourceID = outputDto.Image;

                txtBuyDate.Text   = outputDto.BuyDate.ToString("yyyy-MM-dd");
                txtDep.Text       = outputDto.DepartmentId;
                txtLocation1.Text = outputDto.LocationName;
                txtManager.Text   = outputDto.ManagerName;
                txtName1.Text     = outputDto.Name;
                txtPlace1.Text    = outputDto.Place;
                txtPrice1.Text    = outputDto.Price.ToString();
                txtSN1.Text       = outputDto.SN;
                txtSPE1.Text      = outputDto.Specification;
                txtType.Text      = outputDto.TypeName;
                txtUnit1.Text     = outputDto.Unit;
                txtVendor1.Text   = outputDto.Vendor;
                image2.ResourceID = outputDto.Image;
                txtNote1.Text     = outputDto.Note;
                LocationId        = outputDto.LocationId;
                TypeId            = outputDto.TypeId;
                if (string.IsNullOrEmpty(outputDto.CurrentUser))
                {
                    btnChange.Visible = false;
                    btnChange.Enabled = false;
                    btnLog.Location   = new System.Drawing.Point(47, 2);
                    btnEdit.Location  = new System.Drawing.Point(174, 2);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #8
0
 /// <summary>
 /// 资产删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Press(object sender, EventArgs e)
 {
     try
     {
         AssetsOutputDto ass = _autofacConfig.SettingService.GetAssetsByID(AssId);
         if (ass.Status != (int)STATUS.闲置)
         {
             throw new Exception("资产处于非空闲状态中,无法删除!");
         }
         MessageBox.Show("是否确定删除该资产?", "系统提示", MessageBoxButtons.YesNo, (object sender1, MessageBoxHandlerArgs args) =>
         {
             try
             {
                 if (args.Result == ShowResult.Yes)
                 {
                     ReturnInfo RInfo = _autofacConfig.SettingService.DeleteAssets(AssId, Client.Session["UserID"].ToString());
                     if (RInfo.IsSuccess)
                     {
                         Toast("删除成功!");
                         ShowResult = ShowResult.Yes;
                         Close();
                     }
                     else
                     {
                         throw new Exception(RInfo.ErrorInfo);
                     }
                 }
             }
             catch (Exception ex)
             {
                 Toast(ex.Message);
             }
         });
     }
     catch (Exception ex)
     {
         Toast(ex.Message);
     }
 }
Пример #9
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void Bind()
        {
            try
            {
                AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsBysn(SN);
                if (outputDto != null)
                {
                    id             = outputDto.id;
                    txtAssId1.Text = outputDto.AssId;
                    txtIP1.Text    = outputDto.IP;
                    txtNUm.Text    = outputDto.Num;
                    txtSN1.Text    = outputDto.SN;
                    txtType.Text   = outputDto.TypeName;
                    txtType.Tag    = outputDto.TypeId;

                    txtBrand1.Text    = outputDto.Brandname;
                    txtSPE1.Text      = outputDto.LocationName;
                    txtLocation1.Text = outputDto.Position;
                    txtStatus1.Text   = Enum.GetName(typeof(STATUS), outputDto.Status);
                    txtPayman1.Text   = outputDto.Payman;
                    txtPro1.Text      = outputDto.Project;
                    txtTeam1.Text     = outputDto.Team;
                    txtRole1.Text     = outputDto.Role;
                    txtUserman1.Text  = outputDto.CurrentUserName;

                    txtNote1.Text = outputDto.Note;

                    txtStatus1.Tag  = outputDto.Status;
                    txtBrand1.Tag   = outputDto.Brandid;
                    txtSPE1.Tag     = outputDto.LocationId;
                    txtPayman1.Tag  = outputDto.pay_man_id;
                    txtPro1.Tag     = outputDto.project_id;
                    txtRole1.Tag    = outputDto.role_id;
                    txtTeam1.Tag    = outputDto.team_id;
                    txtUserman1.Tag = outputDto.CurrentUser;

                    //txtBordate1.Text = txtBordate1.Tag != null ? outputDto.BorrowDate.Value.ToString() : "";
                    //txtRedate1.Text = txtRedate1.Tag != null ? outputDto.ReturnDate.Value.ToString() : "";

                    if (outputDto.BorrowDate.HasValue)
                    {
                        DateTime boDate = outputDto.BorrowDate.Value;
                        txtBordate1.Text = boDate.ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        txtBordate1.Text = "";
                    }

                    if (outputDto.ReturnDate.HasValue)
                    {
                        DateTime reDate = outputDto.ReturnDate.Value;
                        txtRedate1.Text = reDate.ToString("yyyy-MM-dd");
                    }
                    else
                    {
                        txtRedate1.Text = "";
                    }


                    //if (string.IsNullOrEmpty(outputDto.CurrentUser))
                    //{
                    //    btnChange.Visible = false;
                    //    btnChange.Enabled = false;
                    //}
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #10
0
        /// <summary>
        /// 点击ActionButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAssets_ActionButtonPress(object sender, ActionButtonPressEventArgs e)
        {
            try
            {
                switch (e.Index)
                {
                case 0:         //资产新增
                    try
                    {
                        if (Client.Session["Role"].ToString() == "SMOSECUser")
                        {
                            throw new Exception("当前用户没有权限添加资产!");
                        }
                        frmAssetsCreate assetsCreate = new frmAssetsCreate();
                        Show(assetsCreate, (MobileForm sender1, object args) =>
                        {
                            if (assetsCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 1:
                    //资产复制
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        var assets = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);

                        frmAssetsCreate assetsCreate = new frmAssetsCreate
                        {
                            DatePickerBuy    = { Value = assets.BuyDate },
                            DepId            = assets.DepartmentId,
                            btnDep           = { Text = assets.DepartmentName + "   > " },
                            DatePickerExpiry = { Value = assets.ExpiryDate },
                            ImgPicture       = { ResourceID = assets.Image },
                            LocationId       = assets.LocationId,
                            btnLocation      = { Text = assets.LocationName },
                            ManagerId        = assets.Manager,
                            txtManager       = { Text = assets.ManagerName },
                            txtName          = { Text = assets.Name },
                            txtNote          = { Text = assets.Note },
                            txtPlace         = { Text = assets.Place },
                            txtPrice         = { Text = assets.Price.ToString() },
                            txtSpe           = { Text = assets.Specification },
                            TypeId           = assets.TypeId,
                            btnType          = { Text = assets.TypeName },
                            txtUnit          = { Text = assets.Unit },
                            txtVendor        = { Text = assets.Vendor }
                        };

                        Show(assetsCreate, (MobileForm sender1, object args) =>
                        {
                            if (assetsCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 2:
                    //资产领用
                    frmCollarOrder frmCO = new frmCollarOrder();
                    Form.Show(frmCO);
                    break;

                case 3:
                    //资产借用
                    frmBorrowOrder frmBO = new frmBorrowOrder();
                    Form.Show(frmBO);
                    break;

                case 4:
                    //维修登记
                    frmRepairRowsSN frmR = new frmRepairRowsSN();
                    this.Form.Show(frmR);
                    break;

                case 5:
                    //报废
                    frmScrapRowsSN frmS = new frmScrapRowsSN();
                    this.Form.Show(frmS);
                    break;

                case 6:
                    //调拨
                    frmTransferRowsSN frmT = new frmTransferRowsSN();
                    this.Form.Show(frmT);
                    break;

                case 7:
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);
                        PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                        //Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "E2000017320082231027BD"));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                        Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                        posPrinter1.Print(Commands, (obj, args) =>
                        {
                            if (args.isError == true)
                            {
                                this.Toast("Error: " + args.error);
                            }
                            else
                            {
                                this.Toast("打印成功");
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #11
0
        /// <summary>
        /// 创建报修单
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Press(object sender, EventArgs e)
        {
            try
            {
                if (String.IsNullOrEmpty(btnDealMan.Text))
                {
                    throw new Exception("报修人不能为空");
                }

                if (String.IsNullOrEmpty(txtrepairman.Text))
                {
                    throw new Exception("维修人不能为空");
                }

                if (String.IsNullOrEmpty(txtContent.Text))
                {
                    throw new Exception("维修内容不能为空!");
                }

                if (String.IsNullOrEmpty(txtNote.Text))
                {
                    throw new Exception("发现者不能为空");
                }

                if (String.IsNullOrEmpty(txtsns.Text))
                {
                    throw new Exception("维修资产SN号不能为空");
                }

                if (String.IsNullOrEmpty(SN))
                {
                    List <string> sn_list = autofacConfig.SettingService.GetAllSns();
                    if (!sn_list.Contains(txtsns.Text))
                    {
                        throw new Exception("不存在序列号为" + txtsns.Text + "的闲置资产");
                    }
                }


                AssetsOutputDto outputDto = autofacConfig.SettingService.GetAssetsBysn(txtsns.Text);

                repairInPutDto repairs = new repairInPutDto
                {
                    //id = 0,
                    find_man       = txtNote.Text,
                    call_man       = btnDealMan.Text,
                    call_date      = DatePicker.Value,
                    repair_man     = txtrepairman.Text,
                    repair_content = txtContent.Text,
                    repair_status  = "等待修",
                    asset_id       = outputDto.id
                };

                //List<AssRepairOrderRow> Data = new List<AssRepairOrderRow>();
                //if (ListAssetsSN.Rows.Count == 0) throw new Exception("维修行项不能为空!");
                //foreach (ListViewRow Row in ListAssetsSN.Rows)
                //{
                //    frmOrderCreateSNLayout Layout = Row.Control as frmOrderCreateSNLayout;
                //    AssetsOrderRow RowData = Layout.getData();
                //    AssRepairOrderRow assRow = new AssRepairOrderRow();

                //    assRow.IMAGE = RowData.IMAGE;
                //    assRow.ASSID = RowData.ASSID;
                //    assRow.WAITREPAIRQTY = RowData.QTY;
                //    assRow.SN = RowData.SN;
                //    assRow.LOCATIONID = RowData.LOCATIONID;
                //    assRow.STATUS = RowData.STATUS;
                //    assRow.CREATEDATE = DateTime.Now;
                //    Data.Add(assRow);
                //}
                //RepairData.Rows = Data;
                ReturnInfo r = autofacConfig.assRepairOrderService.AddAssRepairOrder(repairs);
                if (r.IsSuccess)
                {
                    ShowResult = ShowResult.Yes;
                    Form.Close();          //创建成功
                    Toast("创建维修单成功!");
                }
                else
                {
                    throw new Exception(r.ErrorInfo);
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #12
0
        /// <summary>
        /// 扫描到条码时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BarcodeScanner1_BarcodeScanned(object sender, BarcodeResultArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(e.error))
                {
                    SN          = e.Value;
                    txtsns.Text = e.Value;
                }
                else
                {
                    throw new Exception(e.error);
                }
                List <string> sn_list = autofacConfig.SettingService.GetAllSns();
                if (!sn_list.Contains(SN))
                {
                    throw new Exception("不存在序列号为" + SN + "的闲置资产");
                }

                AssetsOutputDto outputDto = autofacConfig.SettingService.GetAssetsBysn(SN);

                DataRow row = AssTable.NewRow();
                row["ASSID"] = outputDto.AssId;
                row["SN"]    = SN;
                row["ID"]    = outputDto.id;

                //Data.Assid = assets.ASSID;
                //Data.LOCATIONID = assets.LOCATIONID;
                //Data.IMAGE = assets.IMAGE;
                //Data.QTY = 0;
                //Data.SN = SN;
                foreach (var sn in SNRowData)
                {
                    if (sn == SN)
                    {
                        throw new Exception("该资产已添加,请勿重复添加!");
                    }
                }
                AssTable.Rows.Add(row);
                SNRowData.Add(SN);

                //if (SNRowData != null)
                //{
                //    foreach (var sn in SNRowData)
                //    {
                //        if (sn == SN)
                //            throw new Exception("该资产已添加,请勿重复添加!");
                //    }
                //    AssTable.Rows.Add(row);
                //    SNRowData.Add(SN);
                //}
                //else
                //{
                //    List<AssetsOrderRow> Datas = new List<AssetsOrderRow>();
                //    AssTable.Add(Data);
                //    SNRowData = Datas;
                //}
                Bind();        //重新绑定数据
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Пример #13
0
        /// <summary>
        /// 绑定数据
        /// </summary>
        private void Bind()
        {
            try
            {
                AssetsOutputDto outputDto = _autofacConfig.SettingService.GetAssetsBysn(SN);
                if (outputDto != null)
                {
                    id            = outputDto.id;
                    txtAssID.Text = outputDto.AssId;
                    txtName.Text  = outputDto.IP;
                    txtNUm.Text   = outputDto.Num;
                    txtSN.Text    = outputDto.SN;
                    btnType.Text  = outputDto.TypeName + "   > ";
                    TypeId        = outputDto.TypeId;
                    //txtBrand1.Text = outputDto.Brandname;
                    btnBrand.Text    = outputDto.Brandname + "   > ";
                    txtSpe.Text      = outputDto.LocationName + "   > ";
                    txtLocation.Text = outputDto.Position;
                    txtStatus1.Text  = Enum.GetName(typeof(STATUS), outputDto.Status) + "   > ";
                    txtPayman1.Text  = outputDto.Payman + "   > ";
                    txtPro1.Text     = outputDto.Project + "   > ";
                    txtTeam1.Text    = outputDto.Team + "   > ";
                    txtRole1.Text    = outputDto.Role + "   > ";
                    txtUserman1.Text = outputDto.CurrentUserName + "   > ";


                    if (outputDto.BorrowDate.HasValue)
                    {
                        DateTime boDate = outputDto.BorrowDate.Value;
                        txtBordate1.Value = boDate;
                        txtBordate1.Tag   = true;

                        txtBordate1.ZIndex       = 1;
                        txtBordate1.Size         = new System.Drawing.Size(150, 40);
                        btnbodate.Location       = new System.Drawing.Point(250, 560);
                        btnbodate.Size           = new System.Drawing.Size(50, 40);
                        btnbodate.Text           = "清空";
                        this.btnbodate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(164)))), ((int)(((byte)(229)))));
                        give_time = txtBordate1.Value;
                    }
                    else
                    {
                        txtBordate1.Tag = null;
                        //txtBordate1 = null;
                        //txtBordate1.Value = Convert.ToDateTime(null);
                    }
                    if (outputDto.ReturnDate.HasValue)
                    {
                        //DateTime reDate = outputDto.ReturnDate.Value;
                        //txtRedate1.Value = reDate;
                        //MessageBox.Show(txtRedate1.Value.ToString());
                        txtRedate1.Value = outputDto.ReturnDate.Value;
                        txtBordate1.Tag  = true;

                        txtRedate1.ZIndex        = 1;
                        txtRedate1.Size          = new System.Drawing.Size(150, 40);
                        btnredate.Location       = new System.Drawing.Point(250, 600);
                        btnredate.Size           = new System.Drawing.Size(50, 40);
                        btnredate.Text           = "清空";
                        this.btnredate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(164)))), ((int)(((byte)(229)))));
                        return_time = txtBordate1.Value;
                    }
                    else
                    {
                        txtRedate1.Tag = null;
                        //txtRedate1 = null;

                        //txtRedate1.Visible = false;
                        //txtRedate1.Value = Convert.ToDateTime(now);

                        //txtRedate1.Value = Convert.ToDateTime(null);

                        //txtRedate1.Value = Convert.ToDateTime(new Nullable<DateTime>());
                        //MessageBox.Show(txtRedate1.Value.ToString());
                        //string strDate = string.Empty;
                        //System.ComponentModel.NullableConverter nullableDateTime = new System.ComponentModel.NullableConverter(typeof(DateTime?));
                        //DateTime? dt2 = (DateTime?)nullableDateTime.ConvertFromString(strDate);
                        //txtRedate1.Value = (DateTime)dt2;
                    }


                    txtNote.Text = outputDto.Note;

                    Status      = outputDto.Status;
                    Brandid     = outputDto.Brandid;
                    LocationId  = outputDto.LocationId;
                    Pay_man_id  = outputDto.pay_man_id;
                    Project_id  = outputDto.project_id;
                    Role_id     = outputDto.role_id;
                    Team_id     = outputDto.team_id;
                    CurrentUser = outputDto.CurrentUser;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }