예제 #1
0
        public static void SqlUpdate(int id, string desc, int?level1Id, int?level2Id, int?level3Id, int?level4Id, EnumComponentType component, bool billable, decimal amount)
        {
            string sql = $"update FieldPODetail set Description='{desc}', Level1Code={StrEx.ValueOrNull(level1Id)}, Level2Code={StrEx.ValueOrNull(level2Id)}, " +
                         $"Level3Code={StrEx.ValueOrNull(level3Id)}, Level4Code={StrEx.ValueOrNull(level4Id)}, Component='{(char)component}', Billable='{billable}', Amount={amount} where id={id} ";

            MobileCommon.ExecuteNonQuery(sql);
        }
예제 #2
0
        public static void SqlUpdate(int id, string eqpNum, int?empNum, int?changeOrderId, int?level1Id, int?level2Id, int?level3Id, int?level4Id, bool billable, decimal quantity, EnumBillCycle billCycle, decimal?billAmount)
        {
            string sql = $"update EquipTimeEntry set EqpNum={eqpNum}, EmpNum={StrEx.ValueOrNull(empNum)}, Billable='{billable}', ChangeOrderId={StrEx.ValueOrNull(changeOrderId)}, " +
                         $"Level1Id={StrEx.ValueOrNull(level1Id)}, Level2Id={StrEx.ValueOrNull(level2Id)}, Level3Id={StrEx.ValueOrNull(level3Id)}, Level4Id={StrEx.ValueOrNull(level4Id)}, " +
                         $"Quantity={quantity}, BillCycle='{(char)billCycle}', BillAmount={StrEx.ValueOrNull(billAmount)}, SyncStatus='{EnumRecordSyncStatus.NoSubmit}' where Id={id} ";

            MobileCommon.ExecuteNonQuery(sql);
        }
예제 #3
0
        public static int SqlInsert(int entryId, int timecodeId, decimal?billRate, decimal?workHours, decimal?amount)
        {
            string sql = $"Insert LabourTimeDetail(CompanyId, EntryId, TimeCodeId, BillRate, WorkHours, Amount) " +
                         $"values({Company.CurrentId}, {entryId}, {timecodeId}, {StrEx.ValueOrNull(billRate)}, {StrEx.ValueOrNull(workHours)}, {StrEx.ValueOrNull(amount)}); " +
                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

            return(Convert.ToInt32(MobileCommon.ExecuteScalar(sql)));
        }
예제 #4
0
        public static void SqlUpdate(int id, int empNum, int?changeOrderId, int?level1Id, int?level2Id, int?level3Id, int?level4Id, bool billable, bool manual, string workClassCode, decimal?includedHours, decimal?totalHours, decimal?billAmount)
        {
            string sql = $"update LabourTimeEntry set EmpNum={empNum}, ChangeOrderId={StrEx.ValueOrNull(changeOrderId)}, Level1Id={StrEx.ValueOrNull(level1Id)}, Level2Id={StrEx.ValueOrNull(level2Id)}, " +
                         $"Level3Id={StrEx.ValueOrNull(level3Id)}, Level4Id={StrEx.ValueOrNull(level4Id)}, Billable='{billable}', Manual='{manual}', WorkClassCode='{workClassCode}', " +
                         $"IncludedHours={StrEx.ValueOrNull(includedHours)}, TotalHours={StrEx.ValueOrNull(totalHours)}, BillAmount={StrEx.ValueOrNull(billAmount)}, SyncStatus='{EnumRecordSyncStatus.NoSubmit}' where Id={id} ";

            MobileCommon.ExecuteNonQuery(sql);
        }
예제 #5
0
        public static int SqlInsert(int poId, int lineNum, string desc, int?level1Id, int?level2Id, int?level3Id, int?level4Id, EnumComponentType component, bool billable, decimal amount)
        {
            string sql = $"insert FieldPODetail(CompanyId, POId, LineNum, Description, Level1Code, Level2Code, Level3Code, Level4Code, Component, Billable, Amount) " +
                         $"values({Company.CurrentId}, {poId}, {lineNum}, '{desc}', {StrEx.ValueOrNull(level1Id)}, {StrEx.ValueOrNull(level2Id)}," +
                         $" {StrEx.ValueOrNull(level3Id)}, {StrEx.ValueOrNull(level4Id)}, '{(char)component}', '{billable}', {amount}); " +
                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

            return(Convert.ToInt32(MobileCommon.ExecuteScalar(sql)));
        }
예제 #6
0
        public static int SqlInsert(int headerId, string eqpNum, int?empNum, int?changeOrderId, int?level1Id, int?level2Id, int?level3Id, int?level4Id, bool billable, decimal quantity, EnumBillCycle billCycle, decimal?billAmount)
        {
            string sql = $"insert EquipTimeEntry(MatchId, CompanyId, LogHeaderId, EqpNum, EmpNum, changeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Quantity, BillCycle, BillAmount, SyncStatus, Deleted) " +
                         $"values(-1, {Company.CurrentId}, {headerId}, {eqpNum}, {StrEx.ValueOrNull(empNum)}, {StrEx.ValueOrNull(changeOrderId)}, {StrEx.ValueOrNull(level1Id)}, {StrEx.ValueOrNull(level2Id)}, {StrEx.ValueOrNull(level3Id)}, {StrEx.ValueOrNull(level4Id)}," +
                         $" '{billable}', {quantity}, '{(char)billCycle}', {StrEx.ValueOrNull(billAmount)}, '{EnumRecordSyncStatus.NoSubmit}', 0); " +
                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

            return(Convert.ToInt32(MobileCommon.ExecuteScalar(sql)));
        }
예제 #7
0
        public static int SqlInsert(int headerId, int empNum, int?changeOrderId, int?level1Id, int?level2Id, int?level3Id, int?level4Id, bool billable, bool manual, string workClassCode, decimal?includedHours, decimal?totalHours, decimal?billAmount)
        {
            string sql = $"insert LabourTimeEntry(MatchId, CompanyId, LogHeaderId, EmpNum, ChangeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Manual, WorkClassCode, IncludedHours, TotalHours, BillAmount, SyncStatus, Deleted) " +
                         $"values(-1, {Company.CurrentId}, {headerId}, {empNum}, {StrEx.ValueOrNull(changeOrderId)}, {StrEx.ValueOrNull(level1Id)}, {StrEx.ValueOrNull(level2Id)}, " +
                         $"{StrEx.ValueOrNull(level3Id)}, {StrEx.ValueOrNull(level4Id)}, '{billable}', '{manual}', '{workClassCode}', {StrEx.ValueOrNull(includedHours)}, {StrEx.ValueOrNull(totalHours)}, {StrEx.ValueOrNull(billAmount)}, '{EnumRecordSyncStatus.NoSubmit}', 0); " +
                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

            return(Convert.ToInt32(MobileCommon.ExecuteScalar(sql)));
        }
예제 #8
0
        public override async Task <SyncResult> Receive(Guid token)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    var query = HttpUtility.ParseQueryString(string.Empty);
                    query["companyId"] = CompanyId.ToString();
                    query["clientMac"] = MobileCommon.MachineMac;
                    HttpResponseMessage response = await client.GetAsync($"api/LemAP?{query.ToString()}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <LemAP> list = await response.Content.ReadAsAsync <List <LemAP> >();

                        list.ForEach(x =>
                        {
                            BeforeReceiveRecord(x.MatchId);

                            string sql = $"insert LemAp(MatchId, CompanyId, ProjectId, InvoiceDate, LogHeaderId, InvoiceNum, SupplierCode, PONum, InvoiceAmount, MarkupAmount, BillAmount, SyncStatus) " +
                                         $"values({x.MatchId}, {x.CompanyId}, {x.ProjectId}, '{x.InvoiceDate}', null, '{x.InvoiceNum}', '{x.SupplierCode}', '{x.PONum}', {x.InvoiceAmount}, {x.MarkupAmount}, {x.BillAmount}, '{EnumRecordSyncStatus.Receiving}'); " +
                                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

                            int mid = Convert.ToInt32(MobileCommon.ExecuteScalar(sql));
                            foreach (var d in x.DetailList)
                            {
                                sql = $"insert LemAPDetail(MatchId, CompanyId, LemAPId, LineNum, Description, Reference, Amount, MarkupPercent, MarkupAmount, BillAmount, Level1Id, Level2Id, Level3Id, Level4Id) " +
                                      $"values({d.MatchId}, {d.CompanyId}, {mid}, {d.LineNum}, '{d.Description}', '{d.Reference}', {d.Amount}, {d.MarkupPercent}, {d.MarkupAmount}, {d.BillAmount}, " +
                                      $"{StrEx.ValueOrNull(d.Level1Id)}, {StrEx.ValueOrNull(d.Level2Id)}, {StrEx.ValueOrNull(d.Level3Id)}, {StrEx.ValueOrNull(d.Level4Id)});";
                                MobileCommon.ExecuteNonQuery(sql);
                            }
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #9
0
        public override async Task <SyncResult> Receive(Guid token)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    var query = HttpUtility.ParseQueryString(string.Empty);
                    query["companyId"] = CompanyId.ToString();
                    query["clientMac"] = MobileCommon.MachineMac;
                    query["contactId"] = LoginUser.CurrUser.MatchId.ToString();
                    HttpResponseMessage response = await client.GetAsync($"api/LabourTimeEntry?{query.ToString()}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        var list = await response.Content.ReadAsAsync <List <LabourTimeEntry> >();

                        list.ForEach(x =>
                        {
                            BeforeReceiveRecord(x.MatchId);

                            string sql = $"insert LabourTimeEntry(MatchId, CompanyId, LogHeaderId, EmpNum, ChangeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Manual, WorkClassCode, IncludedHours, TotalHours, BillAmount, SyncStatus, Deleted) " +
                                         $"values({x.MatchId}, {x.CompanyId}, {x.HeaderId}, {x.EmpNum}, {StrEx.ValueOrNull(x.ChangeOrderId)}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, " +
                                         $"{StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, '{x.Billable}', '{x.Manual}', '{x.WorkClassCode}', {StrEx.ValueOrNull(x.IncludedHours)}, {StrEx.ValueOrNull(x.TotalHours)}, {StrEx.ValueOrNull(x.BillAmount)}, '{EnumRecordSyncStatus.Receiving}', 0); " +
                                         $"Select CAST(SCOPE_IDENTITY() AS INT);";

                            int entryId = Convert.ToInt32(MobileCommon.ExecuteScalar(sql));
                            foreach (var d in x.DetailList)
                            {
                                LabourTimeDetail.SqlInsert(entryId, d.TimeCodeId, d.BillRate, d.WorkHours, d.Amount);
                            }
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #10
0
        public static void SqlUpdateLemAP(int id, int?logHeaderId)
        {
            if (logHeaderId == null)
            {
                int matchId = (int)MobileCommon.ExecuteScalar($"select isnull(matchid, 0) from LemAP where id={id} and SyncStatus='{EnumRecordSyncStatus.Submitted}'");
                if (matchId != 0)
                {
                    DeleteHistory.SqlInsert(DeleteHistory.LemAPUnselect, matchId);
                }
            }

            string sql = $"update LemAP set LogHeaderId={StrEx.ValueOrNull(logHeaderId)}, SyncStatus='{EnumRecordSyncStatus.NoSubmit}' where Id={id}";

            MobileCommon.ExecuteNonQuery(sql);
        }
예제 #11
0
        public override async Task <SyncResult> Receive(Guid token)
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    var query = HttpUtility.ParseQueryString(string.Empty);
                    query["companyId"] = CompanyId.ToString();
                    query["clientMac"] = MobileCommon.MachineMac;
                    query["contactId"] = LoginUser.CurrUser.MatchId.ToString();
                    HttpResponseMessage response = await client.GetAsync($"api/EquipTimeEntry?{query.ToString()}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        var list = await response.Content.ReadAsAsync <List <EquipTimeEntry> >();

                        list.ForEach(x =>
                        {
                            BeforeReceiveRecord(x.MatchId);
                            string sql = $"insert EquipTimeEntry(MatchID, CompanyId, LogHeaderId, EqpNum, ChangeOrderId, Level1Id, Level2Id, Level3Id, Level4Id, Billable, Quantity, BillCycle, BillAmount, SyncStatus, Deleted) " +
                                         $"values({x.MatchId}, {x.CompanyId}, {x.HeaderId}, '{x.EqpNum}', {StrEx.ValueOrNull(x.ChangeOrderId)}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, " +
                                         $"{StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, '{x.Billable}', {x.Quantity}, '{(char)x.BillCycle}', {StrEx.ValueOrNull(x.BillAmount)}, '{EnumRecordSyncStatus.Receiving}', 0)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
        public override async System.Threading.Tasks.Task <SyncResult> Receive(Guid token)
        {
            try
            {
                ProjectLevelCode.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    var query = HttpUtility.ParseQueryString(string.Empty);
                    query["contactId"] = LoginUser.CurrUser.MatchId.ToString();
                    query["companyId"] = CompanyId.ToString();
                    HttpResponseMessage response = await client.GetAsync($"api/ProjectLevelCode?{query.ToString()}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <ProjectLevelCode> list = await response.Content.ReadAsAsync <List <ProjectLevelCode> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert ProjectLevelCode(ProjectId, CompanyId, Level1Id, Level2Id, Level3Id, Level4Id, InSync) " +
                                         $"values({x.ProjectId}, {x.CompanyId}, {StrEx.ValueOrNull(x.Level1Id)}, {StrEx.ValueOrNull(x.Level2Id)}, {StrEx.ValueOrNull(x.Level3Id)}, {StrEx.ValueOrNull(x.Level4Id)}, 1 )";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
        public override async System.Threading.Tasks.Task <SyncResult> Receive(Guid token)
        {
            try
            {
                ProjectWorkClass.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    HttpResponseMessage response = await client.GetAsync($"api/ProjectWorkClasses?companyId={CompanyId}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <ProjectWorkClass> list = await response.Content.ReadAsAsync <List <ProjectWorkClass> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert ProjectWorkClass(MatchId, CompanyId, ProjectId, WorkClassCode, RegularBillRate, OvertimeBillRate, DoubletimeBillRate, TravelBillRate, Schedulable, CeilingCost, RegularHours, TravelHours, InSync) " +
                                         $"values({x.MatchId}, {x.CompanyId}, {x.ProjectId}, '{x.WorkClassCode}', {StrEx.ValueOrNull(x.RegularBillRate)}, {StrEx.ValueOrNull(x.OvertimeBillRate)}, {StrEx.ValueOrNull(x.DoubleTimeBillRate)}, {StrEx.ValueOrNull(x.TravelBillRate)}," +
                                         $" '{x.Schedulable}', {StrEx.ValueOrNull(x.CeilingCost)}, {StrEx.ValueOrNull(x.RegularHours)}, {StrEx.ValueOrNull(x.TravelHours)}, 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #14
0
        public override async System.Threading.Tasks.Task <SyncResult> Receive(Guid token)
        {
            try
            {
                OvertimeLimit.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    HttpResponseMessage response = await client.GetAsync($"api/OvertimeLimits?companyId={CompanyId}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <OvertimeLimit> list = await response.Content.ReadAsAsync <List <OvertimeLimit> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert OvertimeLimit(MatchId, companyId, ProjectId, Code, [Desc], DailyLimit, DailyDoubleLimit, WeeklyLimit, WeeklyDoubleLimit, InSync) " +
                                         $"values({x.MatchId}, {x.CompanyId}, {StrEx.ValueOrNull(x.ProjectId)}, '{x.Code}', '{x.Desc}', {StrEx.ValueOrNull(x.DailyLimit)}, {StrEx.ValueOrNull(x.DailyDoubleLimit)}, " +
                                         $"{StrEx.ValueOrNull(x.WeeklyLimit)}, {StrEx.ValueOrNull(x.WeeklyDoubleLimit)}, 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #15
0
        public override async Task <SyncResult> Receive(Guid token)
        {
            try
            {
                EquipmentGroupBillRate.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    HttpResponseMessage response = await client.GetAsync($"api/EquipmentGroupBillRates?companyId={CompanyId}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <EquipmentGroupBillRate> list = await response.Content.ReadAsAsync <List <EquipmentGroupBillRate> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert EquipmentGroupBillRate(CompanyId, ProjectId, GroupCode, GroupType, BillCycle, BillRate, IsDefault, InSync) " +
                                         $"values({x.CompanyId}, {StrEx.ValueOrNull(x.ProjectId)}, '{x.GroupCode}', '{(char)x.GroupType}', '{(char)x.BillCycle}', {x.BillRate}, '{x.IsDefault}', 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #16
0
        public override async Task <SyncResult> Receive()
        {
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.Init();
                    HttpResponseMessage response = await client.GetAsync($"api/SecurityFunction");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <SecurityFunction> list = await response.Content.ReadAsAsync <List <SecurityFunction> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert SecurityFunction(Id, ParentId, Description, FieldServices, InSync) values({x.Id}, {StrEx.ValueOrNull(x.ParentId)}, '{x.Description}', '{x.FieldServices}', 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #17
0
        public static void SqlUpdateBillRate(int entryId, int timecodeId, decimal?billRate)
        {
            string sql = $"update LabourTimeDetail set BillRate={StrEx.ValueOrNull(billRate)} where EntryId={entryId} and TimeCodeId={timecodeId}";

            MobileCommon.ExecuteNonQuery(sql);
        }
예제 #18
0
        public override async Task <SyncResult> Receive(Guid token)
        {
            try
            {
                ChangeOrder.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    HttpResponseMessage response = await client.GetAsync($"api/ChangeOrders?companyId={CompanyId}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <ChangeOrder> list = await response.Content.ReadAsAsync <List <ChangeOrder> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert ChangeOrder(CompanyId, ProjectId, EstimateId, ChangeOrderNum, ChangeOrderName, InSync) " +
                                         $"values({x.CompanyId}, {x.ProjectId}, {x.EstimateId}, {StrEx.ValueOrNull(x.ChangeOrderNum)}, '{x.ChangeOrderName}', 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #19
0
        public override async System.Threading.Tasks.Task <SyncResult> Receive(Guid token)
        {
            try
            {
                TimeCode.Refresh();
                using (HttpClient client = new HttpClient())
                {
                    client.Init(token);

                    HttpResponseMessage response = await client.GetAsync($"api/TimeCodes?companyId={CompanyId}");

                    if (response.IsSuccessStatusCode)
                    {
                        UpdateStatus(EnumTableSyncStatus.Receiving);

                        List <TimeCode> list = await response.Content.ReadAsAsync <List <TimeCode> >();

                        list.ForEach(x =>
                        {
                            string sql = $"insert TimeCode(MatchId, companyId, [Desc], ValueType, BillingRateType, OvertimeId, DoubleTimeId, IncludedInWeekCalc, Component, ReportTypeColumn, InSync) " +
                                         $"values({x.MatchId}, {x.CompanyId}, '{x.Desc}', '{x.ValueType}', '{x.BillingType}', {StrEx.ValueOrNull(x.OvertimeId)}, {StrEx.ValueOrNull(x.DoubleTimeId)}, '{x.IncludedInWeekCalc}', '{(char)x.Component}', {StrEx.StrOrNull(x.ReportTypeColumn)}, 1)";
                            MobileCommon.ExecuteNonQuery(sql);
                        });

                        UpdateStatus(EnumTableSyncStatus.CompleteReceive);
                        return(new SyncResult {
                            Successful = true
                        });
                    }
                    throw new Exception($"Response StatusCode={response.StatusCode}");
                }
            }
            catch (Exception e)
            {
                UpdateStatus(EnumTableSyncStatus.ErrorInReceive);
                return(new SyncResult {
                    Successful = false, Task = TableName, Message = e.Message
                });
            }
        }
예제 #20
0
 public static void UpdateKeepDays(int?keepDays)
 {
     MobileCommon.ExecuteNonQuery($"Update SystemInfo set KeepDays={StrEx.ValueOrNull(keepDays)}");
     Current.KeepDays = keepDays;
 }