Exemple #1
0
 private void SetDocuments(Act pModel)
 {
     var groups = Factory.Manager<DocumentGroupManager>().GetByOffice(CurrentInfo.OfficeID);
     var documents = Factory.Manager<DocumentManager>().GetByOffice(CurrentInfo.OfficeID);
     var list = new List<ActDocument>();
     if (pModel != null)
     {
         list = Factory.Manager<ActDocumentManager>().GetForAct(pModel.ID);
         var addList = new List<Document>();
         foreach (var item in list.FindAll(l=>documents.All(d=>d.DocumentID!=l.DocumentID)))
         {
             addList.Add(new Document
                 {
                     DocumentID = item.DocumentID,
                     DocumentName = item.DocumentName,
                     DocumentGroupID = item.DocumentGroupID,
                     OrdNum = item.DocumentOrdNum,
                     Hidden = false,
                     ValueSetID = item.ValueSetID
                 });
             if (groups.All(g => g.ID != item.DocumentGroupID))
             {
                 groups.Add(new DocumentGroup
                     {
                         DocumentGroupID = item.DocumentGroupID,
                         GroupName = item.GroupName,
                         OrdNum = item.GroupOrdNum,
                         Hidden = false
                     });
             }
         }
         if (addList.Count > 0)
             documents.AddRange(addList);
     }
     layoutDocuments.BeginUpdate();
     try
     {
         foreach (var grp in groups.OrderBy(g => g.OrdNum))
         {
             var layoutGroup = layoutDocuments.Root.AddGroup(grp.GroupName);
             layoutGroup.Tag = grp.ID;
             foreach (var document in documents.Where(d => d.DocumentGroupID == grp.ID).OrderBy(d=>d.OrdNum))
             {
                 var item = layoutGroup.AddItem(document.DocumentName);
                 item.TextLocation = Locations.Left;
                 item.Tag = document.ID;
                 var ddl = new LookUpEdit();
                 ddl.Properties.ValueMember = "ID";
                 ddl.Properties.DisplayMember = "DocValue";
                 ddl.Properties.NullText = Resources.nullText;
                 ddl.Properties.Columns.Add(new LookUpColumnInfo
                     {
                         FieldName = "DocValue"
                     });
                 ddl.Properties.ShowHeader = false;
                 ddl.Properties.ShowFooter = false;
                 ddl.Properties.DataSource =
                     Factory.Manager<DocumentValueManager>().GetBySet(document.ValueSetID);
                 item.Control = ddl;
                 var value = list.Find(l => l.DocumentID == document.ID);
                 if (value != null)
                     ddl.EditValue = value.DocumentValueID;
             }
         }
     }
     finally
     {
         layoutDocuments.EndUpdate();
     }
 }
Exemple #2
0
        private void SetPayments(Act pModel)
        {
            var list = Factory.Manager<PaymentDataSettingsManager>().GetByOffice(CurrentInfo.OfficeID);
            foreach (var item in Enum.GetValues(typeof(ePaymentDataField)).Cast<ePaymentDataField>().ToList())
            {
                var layout = groupPayment.Items.Cast<LayoutControlItem>().ToList().Find(
                    i => i.Tag.ToString() == item.ToString());
                var txt = layout.Control as TextEdit;
                if (txt == null) continue;
                switch (item)
                {
                    case ePaymentDataField.TotalCost:
                        txt.EditValue = pModel != null ? pModel.TotalCost : null;
                        break;
                    case ePaymentDataField.PaidOn:
                        txt.EditValue = pModel != null ? pModel.PaidOn : null;
                        break;
                    case ePaymentDataField.LeftOn:
                        txt.EditValue = pModel != null ? pModel.LeftOn : null;
                        break;
                    case ePaymentDataField.Approval1:
                        txt.EditValue = pModel != null ? pModel.Approval1 : null;
                        break;
                    case ePaymentDataField.KailasPaid1:
                        txt.EditValue = pModel != null ? pModel.KailasPaid1 : null;
                        break;
                    case ePaymentDataField.KailasDue:
                        txt.EditValue = pModel != null ? pModel.KailasDue : null;
                        break;
                    case ePaymentDataField.PaidDue:
                        txt.EditValue = pModel != null ? pModel.PaidDue : null;
                        break;
                    case ePaymentDataField.Approval2:
                        txt.EditValue = pModel != null ? pModel.Approval2 : null;
                        break;
                    case ePaymentDataField.KailasPaid2:
                        txt.EditValue = pModel != null ? pModel.KailasPaid2 : null;
                        break;
                }

                if (!list.Find(i=>i.PaymentFieldID==item).Show && txt.EditValue == null)
                {
                    layout.HideToCustomization();
                }
            }
        }
Exemple #3
0
 private void FillPayments(Act pModel)
 {
     if (pModel == null)
         return;
     foreach (var item in groupPayment.Items.Cast<LayoutControlItem>().ToList().FindAll(i => !i.IsHidden))
     {
         var txt = item.Control as TextEdit;
         if (txt == null) continue;
         switch ((ePaymentDataField)Enum.Parse(typeof(ePaymentDataField), item.Tag.ToString()))
         {
             case ePaymentDataField.TotalCost:
                 pModel.TotalCost = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.PaidOn:
                 pModel.PaidOn = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.LeftOn:
                 pModel.LeftOn = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.Approval1:
                 pModel.Approval1 = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.KailasPaid1:
                 pModel.KailasPaid1 = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.KailasDue:
                 pModel.KailasDue = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.PaidDue:
                 pModel.PaidDue = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.Approval2:
                 pModel.Approval2 = GetValue<double?>(txt);
                 break;
             case ePaymentDataField.KailasPaid2:
                 pModel.KailasPaid2 = GetValue<double?>(txt);
                 break;
         }
     }
 }