Example #1
0
 void loadHeader()
 {
     try
     {
         PaidItemHeader head = DAL_PaidItem.Instance.GetPaidItemsHeader();
         lblAcaLevelName.Text  = head.AcademicLevel;
         lblEffectiveDate.Text = head.ActiveDate.ToString();
         txtRule.Text          = head.Rule;
         lblCreaterName.Text   = head.CreatorName;
         lblCreatedDate.Text   = head.CreatedDate.ToString();
         txtNote.Text          = head.Note;
     }
     catch
     {
         PaidItemHeader head = new PaidItemHeader("", DateTime.Now, "", DateTime.Now, "", "");
     }
 }
        public bool Insert(string id, string name, float rate, float unitValue, int typeId, string acaLevelCode)
        {
            List <Object> testList;

            try
            {
                testList = new List <Object>();
                PaidItemHeader pih = new PaidItemHeader("dongnp", DateTime.Now, acaLevelCode, DateTime.Now, "ABC/31T", "");
                testList = (List <Object>)DAL_DataSerializer.Instance.BinaryDeserialize(acaLevelCode + "PaidItem.sf");
                testList.RemoveAt(0);
                testList.Insert(0, pih);
                testList.Add(new PaidItem(id, name, rate, unitValue, typeId, acaLevelCode));
                DAL_DataSerializer.Instance.BinarySerialize(testList, acaLevelCode + "PaidItem.sf");
            }
            catch (Exception ex)
            {
                testList = new List <Object>();
                PaidItemHeader pih = new PaidItemHeader("dongnp", DateTime.Now, acaLevelCode, DateTime.Now, "ABC/31T", "");
                testList.Add(pih);
                testList.Add(new PaidItem(id, name, rate, unitValue, typeId, acaLevelCode));
                DAL_DataSerializer.Instance.BinarySerialize(testList, acaLevelCode + "PaidItem.sf");
            }
            return(true);
        }