public RptExchangePart(Exchangepartdetail spare)
        {
            if (spare != null)
            {
                Warrantycondition warr = WarrantyContent.GetWarrantyCondition(spare.Partcodem);
                if (warr != null)
                {
                    this.Labour = warr.Labour;
                    this.PartNameEn = warr.Partnameen;
                    this.PartNameVn = warr.Partnamevn;
                    this.PartName = (Thread.CurrentThread.CurrentCulture.Name == "vi-VN") ? warr.Partnamevn : warr.Partnameen;
                }
                else
                {
                    //this.PartName = Message.DataLost;
                }

                this.Broken = spare.Broken;
                this.BrokenCode = spare.Broken.Brokencode;
                this.Exchangepartheader = spare.Exchangepartheader;
                this.Id = spare.Id;
                this.Partcodem = spare.Partcodem;
                this.Partcodeo = spare.Partcodeo;
                this.Partqtym = spare.Partqtym;
                this.Partqtyo = spare.Partqtyo;
                this.Serialnumber = spare.Serialnumber;
                this.Totalfeem = spare.Totalfeem;
                this.Totalfeeo = spare.Totalfeeo;
                this.Unitpricem = spare.Unitpricem;
                this.Unitpriceo = spare.Unitpriceo;
                this.Vmepcomment = spare.Vmepcomment;
            }
        }
Ejemplo n.º 2
0
        public PCVItem(Exchangepartdetail ed, ServiceItemState state)
            : this()
        {
            this.Id = ed.Id;
            this.Broken = ed.Broken;
            this.Exchangepartheader = ed.Exchangepartheader;
            this.Partcodem = ed.Partcodem;
            this.Partcodeo = ed.Partcodeo;
            this.Partqtym = ed.Partqtym;
            this.Partqtyo = ed.Partqtyo;
            this.Serialnumber = ed.Serialnumber;
            this.Totalfeem = ed.Totalfeem;
            this.Totalfeeo = ed.Totalfeeo;
            this.Unitpricem = ed.Unitpricem;
            this.Unitpriceo = ed.Unitpriceo;
            this.Vmepcomment = ed.Vmepcomment;

            Warrantycondition warr = WarrantyContent.GetWarrantyCondition(ed.Partcodeo);
            //if (warr == null) throw new Exception(string.Format("Part Code not found: {0}", ed.Partcodeo));
            if (warr != null)
            {
                this.PartName = (UserHelper.Language.Equals("vi-VN")) ? warr.Partnamevn : warr.Partnameen;
                this.Labour = warr.Labour;
                this.SManPower = warr.Manpower;
            }
            this.State = state;
        }
Ejemplo n.º 3
0
        public static WarrantyContentErrorCode SaveExchDetail(DataRow item, Exchangepartheader exchH, IDao<Exchangepartdetail, long> dao, IDao<Broken, long> daoB)
        {
            IList list;
            long eid;
            long.TryParse(item["ItemId"].ToString(), out eid);

            Exchangepartdetail exchD = dao.GetById(eid, true);
            if (exchD == null) exchD = new Exchangepartdetail();

            if (exchH == null) return WarrantyContentErrorCode.SaveExchDetailFailed;
            if (string.IsNullOrEmpty(item["BrokenCode"].ToString())) return WarrantyContentErrorCode.SaveExchDetailFailed;
            if (string.IsNullOrEmpty(item["SpareNumber"].ToString())) return WarrantyContentErrorCode.SaveExchDetailFailed;
            if (string.IsNullOrEmpty(item["Quantity"].ToString())) return WarrantyContentErrorCode.SaveExchDetailFailed;
            //if (string.IsNullOrEmpty(item["SerialNumber"].ToString())) return WarrantyContentErrorCode.SaveExchDetailFailed;
            if (string.IsNullOrEmpty(item["SpareCost"].ToString())) return WarrantyContentErrorCode.SaveExchDetailFailed;

            // get broken object
            daoB.SetCriteria(new ICriterion[] { Expression.Eq("Brokencode", item["BrokenCode"].ToString()) });
            list = daoB.GetAll();
            if (list.Count != 1) return WarrantyContentErrorCode.SaveExchDetailFailed;
            Broken broken = (Broken)list[0];
            long price; long.TryParse(item["SpareCost"].ToString(), out price);

            exchD.Broken = broken;
            exchD.Exchangepartheader = exchH;
            exchD.Partcodem = item["SpareNumber"].ToString();
            exchD.Partcodeo = item["SpareNumber"].ToString();
            exchD.Partqtym = Convert.ToInt32(item["Quantity"].ToString());
            exchD.Partqtyo = exchD.Partqtym;
            //exchD.Serialnumber = ((item["SerialNumber"] == null) || (item["SerialNumber"].ToString().Trim() == "")) ? "�" : item["SerialNumber"].ToString();
            exchD.Serialnumber = item["SerialNumber"].ToString();
            exchD.Unitpricem = price;
            exchD.Unitpriceo = price;
            long.TryParse(item["FeeAmount"].ToString(), out price);
            exchD.Totalfeem = price;
            exchD.Totalfeeo = price;

            try { dao.SaveOrUpdate(exchD); }
            catch { return WarrantyContentErrorCode.SaveDetailFailed; }
            return WarrantyContentErrorCode.OK;
        }
Ejemplo n.º 4
0
 public Exchangepartdetail Base()
 {
     Exchangepartdetail item = new Exchangepartdetail(this.Partcodeo, this.Partcodem, this.Serialnumber, this.Unitpricem, (long)this.FeeAmount, (long)this.FeeAmount, this.Unitpriceo, this.Partqtyo, this.Partqtym, this.Vmepcomment, this.Broken, this.Exchangepartheader);
     item.Id = this.Id;
     return item;
 }