Exemple #1
0
 protected void btnBack_Click(object sender, EventArgs e)
 {
     try
     {
         Response.Redirect("./FrmUserInputBrige.aspx");
     }
     catch (Exception ex)
     {
         ErrorManage.Show(ex.ToString());
     }
 }
    //儲存表單
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            List <TB_Report> lRe            = GetMainReport();
            string           OrIDFromMainRe = lRe.FirstOrDefault().OrderReID;

            using (var en = new WeekReportEntities())
            {
                TB_OrderReport Order = en.TB_OrderReport.Where(p => p.OrderReID == OrIDFromMainRe).FirstOrDefault();


                if (Order == null)
                {
                    en.TB_OrderReport.Add(new TB_OrderReport
                    {
                        OrderReID     = OrIDFromMainRe,
                        OrderedCount  = int.Parse(txtOrderCount.Text),
                        SaleCount     = int.Parse(txtSaleCount.Text),
                        OnControl     = int.Parse(txtOnControl.Text),
                        Expectations  = int.Parse(txtExpectation.Text),
                        OrderDetail   = txtOrderDetail.Text,
                        WeekCar       = txtWeekCar.Text,
                        UnorderDetail = txtUnOrderDetail.Text,
                        Others        = txtOthers.Text,
                        SelfNumber    = int.Parse(txtSelfnumber.Text)
                    });

                    en.SaveChanges();
                }
                else
                {
                    Order.OrderedCount  = int.Parse(txtOrderCount.Text);
                    Order.SaleCount     = int.Parse(txtSaleCount.Text);
                    Order.OnControl     = int.Parse(txtOnControl.Text);
                    Order.Expectations  = int.Parse(txtExpectation.Text);
                    Order.OrderDetail   = txtOrderDetail.Text;
                    Order.WeekCar       = txtWeekCar.Text;
                    Order.UnorderDetail = txtUnOrderDetail.Text;
                    Order.Others        = txtOthers.Text;
                    Order.SelfNumber    = int.Parse(txtSelfnumber.Text);
                    en.SaveChanges();
                }

                this.LoadReportData();
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }
Exemple #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            using (var en = new WeekReportEntities())
            {
                TB_Report ReMain = Tool.GetNowReport((TB_User)Session[GlobalInfo.Session_User]).FirstOrDefault();

                TB_CarAssRe CarAssRe = en.TB_CarAssRe.Where(p => p.CarAssReID == ReMain.CarAssReID).FirstOrDefault();

                if (CarAssRe != null)
                {
                    CarAssRe.RefinementNum   = Convert.ToInt32(txtRefinementNum.Text);
                    CarAssRe.VAudioNum       = Convert.ToInt32(txtVAudioNum.Text);
                    CarAssRe.RefineDetail    = txtRefineDetail.Text;
                    CarAssRe.AssProNum       = Convert.ToInt32(txtAssProNum.Text);
                    CarAssRe.PDSProNum       = Convert.ToInt32(txtPDSProNum.Text);
                    CarAssRe.OthersProDetail = txtOtherProDetail.Text;
                    CarAssRe.SelfNumber      = Convert.ToInt32(txtSelfNum.Text);
                    en.SaveChanges();
                }
                else
                {
                    en.TB_CarAssRe.Add(new TB_CarAssRe
                    {
                        CarAssReID    = ReMain.CarAssReID,
                        RefinementNum = Convert.ToInt32(txtRefinementNum.Text),
                        VAudioNum     = Convert.ToInt32(txtVAudioNum.Text),

                        RefineDetail    = txtRefineDetail.Text,
                        AssProNum       = Convert.ToInt32(txtAssProNum.Text),
                        PDSProNum       = Convert.ToInt32(txtPDSProNum.Text),
                        OthersProDetail = txtOtherProDetail.Text,
                        SelfNumber      = Convert.ToInt32(txtSelfNum.Text)
                    });
                    en.SaveChanges();
                }
                LoadReportData();
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            using (var en = new WeekReportEntities())
            {
                TB_Report ReMain = Tool.GetNowReport((TB_User)Session[GlobalInfo.Session_User]).FirstOrDefault();

                TB_HumanRe HumanRe = en.TB_HumanRe.Where(p => p.HumanResourceReID == ReMain.HumanManageReID).FirstOrDefault();

                if (HumanRe == null)
                {
                    en.TB_HumanRe.Add(new TB_HumanRe
                    {
                        HumanResourceReID = ReMain.HumanManageReID,
                        PeopleNeed        = Convert.ToInt32(txtHumanLess.Text),
                        Interview         = Convert.ToInt32(txtInterview.Text),
                        NewEmpDetail      = txtObservation.Text,
                        SpecialEmp        = txtWeekPeople.Text,
                        WeekGoodEmp       = txtGoodSales.Text,
                        SelfNumber        = Convert.ToInt32(txtSelfNumber.Text)
                    });

                    en.SaveChanges();
                }
                else
                {
                    HumanRe.PeopleNeed   = Convert.ToInt32(txtHumanLess.Text);
                    HumanRe.Interview    = Convert.ToInt32(txtInterview.Text);
                    HumanRe.NewEmpDetail = txtObservation.Text;
                    HumanRe.SpecialEmp   = txtWeekPeople.Text;
                    HumanRe.WeekGoodEmp  = txtGoodSales.Text;
                    HumanRe.SelfNumber   = Convert.ToInt32(txtSelfNumber.Text);

                    en.SaveChanges();
                }
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }
Exemple #5
0
    //建立一個新的周報表
    protected void BtnStartClick(object sender, EventArgs e)
    {
        try
        {
            TB_User user = ((TB_User)Session[GlobalInfo.Session_User]);

            using (var en = new WeekReportEntities())
            {
                //新增報表
                en.TB_Report.Add(new TB_Report
                {
                    TimeStart = GetTime0((DateTime)Session[GlobalInfo.Session_StartTime]),
                    TimeEnd   = GetTime1((DateTime)Session[GlobalInfo.Session_EndTime]),
                    Bureau    = user.Bureau,
                    Class     = user.Class,
                    Writer    = user.name,
                    //給編號 所別+課別+起始日
                    OrderReID       = user.Bureau + user.Class + "Or" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "").Replace(":", ""),
                    InsurenceReID   = user.Bureau + user.Class + "In" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "").Replace(":", ""),
                    OldCarSaleReID  = user.Bureau + user.Class + "Ol" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "").Replace(":", ""),
                    CarAssReID      = user.Bureau + user.Class + "Ca" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "").Replace(":", ""),
                    HumanManageReID = user.Bureau + user.Class + "Hu" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss").Replace("-", "").Replace(":", "")
                });
                en.SaveChanges();
            }
            if (CheckExist())
            {
                btnStart.Enabled = false;
                btnCa.Enabled    = true;
                btnHu.Enabled    = true;
                btnIn.Enabled    = true;
                btnOl.Enabled    = true;
                btnOr.Enabled    = true;
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }
    //抓出報表主檔
    public List <TB_Report> GetMainReport()
    {
        using (var en = new WeekReportEntities())
        {
            TB_User user = ((TB_User)Session[GlobalInfo.Session_User]);

            //end必須從新設定
            List <TB_Report> data = (from q in en.TB_Report
                                     where q.Bureau == user.Bureau &&
                                     q.Class == user.Class &&
                                     q.TimeStart <= DateTime.Now &&
                                     q.TimeEnd >= DateTime.Now
                                     select q).ToList();

            //偵錯
            if (data.Count() > 1)
            {
                ErrorManage.Show("比數大於二有問題");
            }

            return(data);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            var lR = GetMainReport().FirstOrDefault();
            using (var en = new WeekReportEntities())
            {
                TB_InsurenceRe InReport = en.TB_InsurenceRe.Where(p => p.InsurenceID == lR.InsurenceReID).FirstOrDefault();

                if (InReport != null)
                {
                    InReport.AnyCaseToNow   = int.Parse(txtAnyCaseToNow.Text);
                    InReport.CarBdCaseToNow = int.Parse(txtCarBdCaseToNow.Text);
                    InReport.MoneyToNow     = int.Parse(txtMoneyToNow.Text);
                    InReport.AnyCaseSec     = int.Parse(txtAnyCaseSec.Text);
                    InReport.WeekTotalBd    = int.Parse(txtWeekTotalBd.Text);

                    InReport.MonTotalExR = int.Parse(txtMonTotalExR.Text);
                    InReport.MonAnyExR   = int.Parse(txtMonAnyExR.Text);
                    InReport.MonBdExR    = int.Parse(txtMonBdExR.Text);

                    InReport.TotalWeekImport = int.Parse(txtImportC.Text);

                    InReport.RefinProject = txtRefineProject.Text;

                    InReport.SelfNumber = int.Parse(txtSelfNumber.Text);

                    en.SaveChanges();
                }
                else
                {
                    en.TB_InsurenceRe.Add(new TB_InsurenceRe
                    {
                        InsurenceID = lR.InsurenceReID,

                        AnyCaseToNow   = int.Parse(txtAnyCaseToNow.Text),
                        CarBdCaseToNow = int.Parse(txtCarBdCaseToNow.Text),
                        MoneyToNow     = int.Parse(txtMoneyToNow.Text),
                        AnyCaseSec     = int.Parse(txtAnyCaseSec.Text),
                        WeekTotalBd    = int.Parse(txtWeekTotalBd.Text),

                        MonTotalExR = int.Parse(txtMonTotalExR.Text),
                        MonAnyExR   = int.Parse(txtMonAnyExR.Text),
                        MonBdExR    = int.Parse(txtMonBdExR.Text),

                        TotalWeekImport = int.Parse(txtImportC.Text),

                        RefinProject = txtRefineProject.Text,

                        SelfNumber = int.Parse(txtSelfNumber.Text)
                    });

                    en.SaveChanges();
                }

                this.LoadReportData();
            }
        }
        catch (Exception ex)
        {
            ErrorManage.Show(ex.ToString());
        }
    }