Ejemplo n.º 1
0
        public async static Task <EstateCases> GetEstateCase(int CaseID)
        {
            string q = "Select * from core.estatecases " +
                       "inner join core.EstateCaseSettingData on core.estatecases.id = " +
                       "core.EstateCaseSettingData.EstateCaseID " +
                       "inner join core.CaseNotifications on core.EstateCases.id = core.CaseNotifications.CaseID " +
                       "where core.estatecases.id = " + CaseID.ToString();

            DataTable dt = await
                           GlobalVariables.GetConnection().Connection.GetDataTableAsync(q);

            EstateCases r = new EstateCases();

            if (dt.Rows.Count > 0 && dt.Rows[0][0].ToString() != "Error")
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int      caseid          = Convert.ToInt32(dr[0].ToString());
                    int      estID           = Convert.ToInt32(dr[7].ToString());
                    int      caseOwnerid     = Convert.ToInt32(dr[4].ToString());
                    int      caseCreatedbyid = Convert.ToInt32(dr[5].ToString());
                    int      TemplateID      = Convert.ToInt32(dr[10].ToString());
                    long     docinsID        = (long)Convert.ToInt64(dr[8].ToString());
                    DateTime targetdate      = Convert.ToDateTime(dr[9].ToString());
                    DateTime CreatedDate     = Convert.ToDateTime(dr[6].ToString());


                    //int.TryParse(dr[14].ToString(), out int NotificationID);
                    //long.TryParse(dr[16].ToString(), out long NotificationDocInstance);


                    r.id          = caseid;
                    r.CaseTitle   = dr[1].ToString();
                    r.CaseDetails = dr[2].ToString();
                    if (dr[3].ToString() == "Closed")
                    {
                        r.caseStatus = EstateCases.CaseStatus.Closed;
                    }
                    else if (dr[3].ToString() == "Open")
                    {
                        r.caseStatus = EstateCases.CaseStatus.Open;
                    }

                    r.CaseOwner = new UsersDLL.Users {
                        UserID = caseOwnerid
                    };
                    r.CreatedBy = new UsersDLL.Users {
                        UserID = caseCreatedbyid
                    };
                    r.CreatedDate = CreatedDate;
                    r.Estate      = new Estates {
                        EstatedID = estID
                    };
                    r.DocInstanceId        = docinsID;
                    r.TargetCompletionDate = targetdate;
                    r.TemplateID           = TemplateID;
                    r.CaseData.CaseID      = caseid;
                    r.EmailGuid            = dr[11].ToString();
                    //r.EstateCaseNotification = new EstateCaseNotifications(r.id);
                    //r.EstateCaseNotification.id = NotificationID;
                    //r.EstateCaseNotification.DocinstanceID = NotificationDocInstance;
                }
            }

            return(r);
        }
Ejemplo n.º 2
0
 public CaseDetailViewModel()
 {
     EstateCase = new EstateCases();
 }