Ejemplo n.º 1
0
        void RefreshBillRate(DataRow row)
        {
            var equip = Equipment.GetEquipment(Convert.ToString(row[colEqpNum.FieldName]));

            if (equip != null && row[colBillCycle.FieldName] != DBNull.Value)
            {
                EnumBillCycle cycle = ConvertEx.CharToEnum <EnumBillCycle>(row[colBillCycle.FieldName]);
                var           list  = equip.GetBillRateList(_headerRecord.ProjectId);
                row[colBillRate.FieldName] = (object)list.SingleOrDefault(x => x.BillCycle == cycle)?.BillRate ?? DBNull.Value;
            }
            else
            {
                row[colBillRate.FieldName] = DBNull.Value;
            }
            RefreshBillAmount(row);
        }
Ejemplo n.º 2
0
 public EquipTimeEntry(DataRow row)
 {
     Id            = (int)row["Id"];
     MatchId       = (int)row["MatchId"];
     CompanyId     = (int)row["CompanyId"];
     HeaderId      = (int)row["LogHeaderId"];
     EqpNum        = (string)row["EqpNum"];
     EmpNum        = ConvertEx.ToNullable <int>(row["EmpNum"]);
     ChangeOrderId = ConvertEx.ToNullable <int>(row["ChangeOrderId"]);
     Level1Id      = ConvertEx.ToNullable <int>(row["Level1Id"]);
     Level2Id      = ConvertEx.ToNullable <int>(row["Level2Id"]);
     Level3Id      = ConvertEx.ToNullable <int>(row["Level3Id"]);
     Level4Id      = ConvertEx.ToNullable <int>(row["Level4Id"]);
     Billable      = (bool)row["Billable"];
     Quantity      = Convert.ToDecimal(row["Quantity"]);
     BillCycle     = ConvertEx.CharToEnum <EnumBillCycle>(row["BillCycle"]);
     BillAmount    = ConvertEx.ValueOrZero <decimal>(row["BillAmount"]);
 }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
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)));
        }