Ejemplo n.º 1
0
 public PersonalPieceDetailDialog(ClientPersonalPieceBillSave record)
 {
     InitializeComponent();
     Util.SetSceen(this);
     personalPiece = record;
     listView1.BeginUpdate();
     foreach (var detail in record.Details)
     {
         var item = new ListViewItem(detail.Employee_Name);
         item.SubItems.Add(detail.Job_Name);
         item.SubItems.Add(detail.PieceItem_Name);
         item.SubItems.Add(string.Format("{0}", detail.Number));
         listView1.Items.Add(item);
     }
     listView1.EndUpdate();
 }
Ejemplo n.º 2
0
        public PersonalPieceDialog(long departMentID, long template)
        {
            InitializeComponent();
            Util.SetSceen(this);
            personalPiece = new ClientPersonalPieceBillSave
            {
                AccountingUnit_ID = SysConfig.Current.AccountingUnit_ID.Value,
                Department_ID     = departMentID,
                Domain_ID         = SysConfig.Current.Domain_ID,
                User_ID           = SysConfig.Current.User_ID,
                CreateTime        = DateTime.Now
            };
            pieceItemJobPair = new Dictionary <long, Tuple <long?, string> >();

            comboBoxEmployee.Items.Add("");
            comboBoxPieceItem.Items.Add("");

            string file = Path.Combine(Path.Combine(Util.DataFolder, typeof(ClientPersonalPiece).Name), template.ToString() + ".xml");

            XmlSerializer serializer = new XmlSerializer(typeof(ClientPersonalPiece));

            using (var stream = File.Open(file, FileMode.Open))
            {
                personalPieceTemplate = serializer.Deserialize(stream) as ClientPersonalPiece;
            }
            foreach (var empDetail in personalPieceTemplate.EmployeeDetails)
            {
                if (empDetail.Employee_ID != 0)
                {
                    comboBoxEmployee.Items.Add(new Option(empDetail.Employee_Name + "(" + empDetail.Employee_Code + ")", empDetail.Employee_ID));
                }
            }
            foreach (var pieceItemDetail in personalPieceTemplate.PieceItemDetails)
            {
                if (pieceItemDetail.PieceItem_ID != 0)
                {
                    comboBoxPieceItem.Items.Add(new Option(pieceItemDetail.PieceItem_Name, pieceItemDetail.PieceItem_ID));
                }
                if (!pieceItemJobPair.ContainsKey(pieceItemDetail.PieceItem_ID))
                {
                    pieceItemJobPair.Add(pieceItemDetail.PieceItem_ID, new Tuple <long?, string>(pieceItemDetail.Job_ID, pieceItemDetail.Job_Name));
                }
            }

            comboBoxEmployee.Focus();
            HardwareUtil.Device.ScannerReader += new EventHandler <ScanEventArgs>(Device_ScannerReaders);
        }