Exemplo n.º 1
0
    protected void txtsave_Click(object sender, EventArgs e)
    {
        string process = txtprocess.Text;
        string Class = txtclass.Text;
        string pdline = txtpdline.Text;
        DinnerTimeInfo dinnerinfo = new DinnerTimeInfo()
        {
            Process = txtprocess.SelectedValue,
            Type = txttype.SelectedValue,
            Class = txtclass.SelectedValue,
            PdLine = txtpdline.SelectedValue,
            BeginTime = txtfromdate.Value,
            EndTime = txttodate.Value,
            Remark = "Insert! " + txtremark.Text,
            Editor = Master.userInfo.UserId,
            Cdt = DateTime.Now,
            Udt = DateTime.Now
        };

        DinnerLogInfo dinnerLoginfo = new DinnerLogInfo()
        {
            Process = txtprocess.SelectedValue,
            Type = txttype.SelectedValue,
            Class = txtclass.SelectedValue,
            PdLine = txtpdline.SelectedValue,
            BeginTime = txtfromdate.Value,
            EndTime = txttodate.Value,
            Remark = "Insert! "+txtremark.Text,
            Editor = Master.userInfo.UserId,
            Cdt = DateTime.Now,
        };

        if (txtfromdate.Value.Trim() == "" || txttodate.Value.Trim() == "")
        {
            Response.Write("<script>alert('請選擇時間段!')</script>");
        }
        else
        {
            DinnerTime.AddDinnerLogInfo(dinnerLoginfo);
            DinnerTime.AddDinnerTimeInfo(dinnerinfo);
            txtremark.Text = "";
            
        }
       DataTable dt = DinnerTime.GetAllDinnerProcessClass(process, Class, pdline);
       BindTable(dt);

    }
Exemplo n.º 2
0
    private void InputExcel(string pPath)
    {
        int NUM = 0;
        ToolUtility TU = new ToolUtility();
        DataTable DT = TU.getExcelSheetData(pPath, false);
        DataTable dinnertime = DinnerTime.GetAllDinnerTime();
        foreach (DataRow DR in DT.Rows)
        {
            DinnerTimeInfo dinnerinfo = new DinnerTimeInfo()
            {
                Process = DR["Process"].ToString().Trim(),
                Type = DR["Type"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Remark = DR["Remark"].ToString().Trim(),
                Editor = Master.userInfo.UserId,
                Cdt = DateTime.Now,
                Udt = DateTime.Now
            };

            DinnerLogInfo dinnerLoginfo = new DinnerLogInfo()
            {
                Process = DR["Process"].ToString().Trim(),
                Type = DR["Type"].ToString().Trim(),
                Class = DR["Class"].ToString().Trim(),
                PdLine = DR["PdLine"].ToString().Trim(),
                BeginTime = DR["BeginTime"].ToString().Trim(),
                EndTime = DR["EndTime"].ToString().Trim(),
                Remark = DR["Remark"].ToString().Trim(),
                Editor = Master.userInfo.UserId,
                Cdt = DateTime.Now
            };

            if (dinnerinfo.Process != "" && dinnerinfo.Type != "" && dinnerinfo.Class != "" && dinnerinfo.PdLine != "" && dinnerinfo.BeginTime != "" && dinnerinfo.EndTime != "")
            {
                DinnerTime.AddDinnerLogInfo(dinnerLoginfo);
                DinnerTime.AddDinnerTimeInfo(dinnerinfo);
            }
            else
            {
                NUM += 1;
                continue;
            }
            foreach (DataRow allDR in dinnertime.Rows)
            {
                if (allDR["Class"].ToString().Trim() == DR["Class"].ToString().Trim() && allDR["PdLine"].ToString().Trim() == DR["PdLine"].ToString().Trim())
                {
                    string id  = allDR["ID"].ToString().Trim();
                    DinnerTime.DelDinnerTime(Int32.Parse(id));
                    id = null;
                }
            }
        }
        txtremark.Text = "";
        txtquery_Click(null, null);
    }
Exemplo n.º 3
0
 public void AddDinnerTimeInfo(DinnerTimeInfo q)
 {
     string methodName = MethodBase.GetCurrentMethod().Name;
     BaseLog.LoggingBegin(logger, methodName);
     try
     {
         DinnerTime items = new DinnerTime
         {
             ID = q.ID,
             Process = q.Process,
             Type = q.Type,
             Class = q.Class,
             PdLine = q.PdLine,
             BeginTime = q.BeginTime,
             EndTime = q.EndTime,
             Remark = q.Remark,
             Editor = q.Editor,
             Cdt = q.Cdt,
             Udt = q.Udt
         };
         using (UnitOfWork uow = new UnitOfWork())
         {
             IRepository<DinnerTime> ecoModelRep = new Repository<DinnerTime>("UPHDBServer");
             ecoModelRep.Insert(items);
             uow.Commit();
         }
     }
     catch (Exception e)
     {
         BaseLog.LoggingError(logger, MethodBase.GetCurrentMethod(), e);
         throw;
     }
     finally
     {
         BaseLog.LoggingEnd(logger, methodName);
     }
 }