예제 #1
0
        public bool Save()
        {
            dbConnect con = new dbConnect();
            bool      ret = con.SaveCheckOut(this);

            if (ret && this.LstItems.Count > 0)
            {
                this.Id = clsCheckOut.GetCheckOutID(this.Timestamp, this.UserName);
                con.DeleteCheckOutItem(this.Id);
                foreach (clsCheckOutItem chkOutItem in this.LstItems)
                {
                    chkOutItem.CheckOutId = this.Id;
                    if (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount != 0)
                    {
                        chkOutItem.Remarks = string.Format("{0} [{1:0.00}]", chkOutItem.ActualAmount - chkOutItem.ExpectedAmount > 0 ? "Over" : (chkOutItem.ActualAmount - chkOutItem.ExpectedAmount == 0 ? "Match" : "Short"), chkOutItem.ActualAmount - chkOutItem.ExpectedAmount);
                    }
                    else
                    {
                        chkOutItem.Remarks = "Match";
                    }
                    chkOutItem.Save();
                }
            }
            con.Close();
            return(ret);
        }