Ejemplo n.º 1
0
        public IHttpActionResult Get(int companyId)
        {
            try
            {
                string sql = $"select w.Id, w.Description, w.ValueType, isnull(w.BillingRateType, 'Unknown')[BillingRateType], " +
                             $"w.InclInHoursThisWeek, w.Time_Code_ID_OT, w.Time_Code_ID_DT, e.comp_code[Component], ReportTypeColumn from WS_EMP_Time_Code w " +
                             $"join earn_code e on e.eg_code = w.eg_code and e.ec_code = w.ec_code";

                DataTable table = SqlCommon.ExecuteDataAdapter(sql, WebCommon.GetTRConnectionAsync(companyId));

                List <TimeCode> list = new List <TimeCode>();
                table.Select().ToList().ForEach(r => list.Add(new TimeCode
                {
                    MatchId            = (int)r["Id"],
                    CompanyId          = companyId,
                    Desc               = $"{r["Description"]}",
                    ValueType          = ConvertEx.StringToEnum <EnumValueType>(r["ValueType"]),
                    BillingType        = ConvertEx.StringToEnum <EnumBillingRateType>(r["BillingRateType"]),
                    OvertimeId         = r.Field <int?>("Time_Code_ID_OT"),
                    DoubleTimeId       = r.Field <int?>("Time_Code_ID_DT"),
                    IncludedInWeekCalc = (bool)r["InclInHoursThisWeek"],
                    Component          = ConvertEx.CharToEnum <EnumComponentType>(r["Component"]),
                    ReportTypeColumn   = Convert.ToString(r["ReportTypeColumn"])
                }));

                return(Ok(list));
            }
            catch (Exception e)
            {
                SqlCommon.ReportInfo(e.Message);
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult Get()
        {
            try
            {
                string    sql   = $"select * from COMPANIES";
                DataTable table = SqlCommon.ExecuteDataAdapter(sql, WebCommon.WebConnection);

                List <Company> list = new List <Company>();
                table.Select().ToList().ForEach(r => list.Add(new Company
                {
                    MatchId     = (int)r["AutoID"],
                    CompanyName = (string)r["Company_Name"],
                    ShortName   = ConvertEx.StrOrEmpty(r["companyShortName"]),
                    Active      = (bool)r["Active"],
                }));

                foreach (var com in list)
                {
                    sql   = @"select * from Company";
                    table = SqlCommon.ExecuteDataAdapter(sql, WebCommon.GetTRConnectionAsync(com.MatchId));
                    com.CompanyAddress1 = Convert.ToString(table.Rows[0]["ADD1"]);
                    com.CompanyAddress2 = Convert.ToString(table.Rows[0]["ADD2"]);
                    com.CompanyAddress3 = Convert.ToString(table.Rows[0]["ADD3"]);
                    com.CompanyCity     = Convert.ToString(table.Rows[0]["City"]);
                    com.CompanyState    = Convert.ToString(table.Rows[0]["State"]);
                    com.CompanyZip      = Convert.ToString(table.Rows[0]["Zip"]);
                    com.CompanyPhone    = Convert.ToString(table.Rows[0]["Phone"]);
                    com.CompanyFax      = Convert.ToString(table.Rows[0]["Fax"]);
                    com.CompanyEmail    = Convert.ToString(table.Rows[0]["Email"]);
                    com.CompanyWeb      = Convert.ToString(table.Rows[0]["WebPage"]);

                    sql = "select isnull(case when rtrim(week_start) = '' then null else week_start end, 'U') as week_start from hr_cntl";
                    EnumDayInWeek day = ConvertEx.CharToEnum <EnumDayInWeek>(SqlCommon.ExecuteScalar(sql, WebCommon.GetTRConnectionAsync(com.MatchId)));
                    com.WeekStart = ConvertEx.StringToEnum <DayOfWeek>(Enum.GetName(typeof(EnumDayInWeek), day));

                    sql   = @"select use_cat_class from fa_setup";
                    table = SqlCommon.ExecuteDataAdapter(sql, WebCommon.GetTRConnectionAsync(com.MatchId));
                    com.EquipRateGroupType = (EnumGroupType)Convert.ToChar(table.Rows[0]["use_cat_class"]);

                    sql              = @"select lv1_active_gc, lv1_gencon_desc, lv2_active_gc, lv2_gencon_desc, lv3_active_gc, lv3_gencon_desc, lv4_active_gc, lv4_gencon_desc from proj_cntl";
                    table            = SqlCommon.ExecuteDataAdapter(sql, WebCommon.GetTRConnectionAsync(com.MatchId));
                    com.MaxLevelCode = (table.Rows[0]["lv4_active_gc"] != DBNull.Value ? 4 :
                                        (table.Rows[0]["lv3_active_gc"] != DBNull.Value ? 3 :
                                         (table.Rows[0]["lv2_active_gc"] != DBNull.Value ? 2 :
                                          (table.Rows[0]["lv1_active_gc"] != DBNull.Value ? 1 : 0))));
                    com.Level1CodeDesc = Convert.ToString(table.Rows[0]["lv1_gencon_desc"]);
                    com.Level2CodeDesc = Convert.ToString(table.Rows[0]["lv2_gencon_desc"]);
                    com.Level3CodeDesc = Convert.ToString(table.Rows[0]["lv3_gencon_desc"]);
                    com.Level4CodeDesc = Convert.ToString(table.Rows[0]["lv4_gencon_desc"]);
                }

                return(Ok(list));
            }
            catch (Exception e)
            {
                SqlCommon.ReportInfo(e.Message);
                return(BadRequest(e.Message));
            }
        }
Ejemplo n.º 3
0
 public SyncStatus(DataRow row)
 {
     Id          = (int)row["Id"];
     CompanyId   = ConvertEx.ToNullable <int>(row["CompanyId"]);
     SyncTable   = (string)row["SyncTable"];
     SyncName    = (string)row["SyncName"];
     DisplayName = (string)row["DisplayName"];
     DoSync      = (bool)row["DoSync"];
     SyncType    = ConvertEx.StringToEnum <EnumSyncType>(row["SyncType"]);
     Status      = ConvertEx.StringToEnum <EnumTableSyncStatus>(row["Status"]);
 }
Ejemplo n.º 4
0
        private void SetSubmitStatus(EnumSubmitStatus status)
        {
            DataRow row = gvPO.GetFocusedDataRow();

            if (row != null && row[colStatus.FieldName] != DBNull.Value && ConvertEx.StringToEnum <EnumSubmitStatus>(row[colStatus.FieldName]) != status)
            {
                row[colStatus.FieldName] = Enum.GetName(typeof(EnumSubmitStatus), status);
                FieldPO.SqlUpdateStatus((int)row[colId.FieldName], status);
                btnSubmit.Enabled = (status == EnumSubmitStatus.Open);
            }
        }
Ejemplo n.º 5
0
        private void SetSubmitStatus(EnumSubmitStatus status)
        {
            var row = gridView1.GetDataRow(gridView1.FocusedRowHandle);

            if (row != null && row.GetValue(colSubmitStatus) != DBNull.Value && ConvertEx.StringToEnum <EnumSubmitStatus>(row.GetValueString(colSubmitStatus)) != status)
            {
                row.SetValue(colSubmitStatus, GetEnumName(status));
                LemHeader.SqlUpdateSubmitStatus(row.GetValue <int>(colId), status);
                btnSubmit.Enabled = (status == EnumSubmitStatus.Open);
            }
        }