コード例 #1
0
 public FormJobMainView(JobMain job,String keyName)
     : this()
 {
     _keyName = keyName;
     _Job = job;
     InitView();
 }
コード例 #2
0
ファイル: CheckJob.cs プロジェクト: mirror4/TrainCheck
        public static int JobInsert(JobMain job)
        {
            int    needCheckcount = Int32.Parse(DataAccess.ExecuteScalar("select count(*) from DictSpecs").ToString());
            String sqlstring      = String.Format(@"Insert into JobMain(jobdate,userid,begintime,isUploaded,NeedCheckPosition,CheckPosition,PassPosition)
                                            Values(getdate(),{0},getdate(),0,{1},0,0)", job.UserID, needCheckcount);

            DataAccess.ExecuteNonQuery(sqlstring);
            int result = Int32.Parse(DataAccess.ExecuteScalar("Select max(id) from jobmain").ToString());

            job.ID = result;
            job.NeedCheckPosition = needCheckcount;
            return(result);
        }
コード例 #3
0
ファイル: CheckJob.cs プロジェクト: ddssssdd/TrainCheck
 public static JobMain Create(Int32 id)
 {
     JobMain result;
     if (id == 0)
     {
         result = new JobMain();
         result.UserID = AppHelper.UserID;
         result.ID= SaveJob(result);
     }
     else
         result = FindJobMain(id);
     return result;
 }
コード例 #4
0
ファイル: FormCheck.cs プロジェクト: mirror4/TrainCheck
 public FormCheck(JobMain job) : this()
 {
     CurrentJob = job;
     if (job.Items.Count > 0)
     {
         Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID);
         Specs spec    = DbFactory.FindByFilter("ID=" + specsid.ToString());
         if (spec != null)
         {
             CurrentSpecs = spec;
             InitView();
         }
     }
 }
コード例 #5
0
ファイル: FormCheck.cs プロジェクト: ddssssdd/TrainCheck
 public FormCheck(JobMain job)
     : this()
 {
     CurrentJob = job;
     if (job.Items.Count > 0)
     {
         Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID);
         Specs spec = DbFactory.FindByFilter("ID=" + specsid.ToString());
         if (spec != null)
         {
             CurrentSpecs = spec;
             InitView();
         }
     }
 }
コード例 #6
0
 public FormCheck(JobMain job) : this()
 {
     CurrentJob = job;
     if (job.Items.Count > 0)
     {
         //Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID);
         //Specs spec = DbFactory.FindByFilter("ID=" + specsid.ToString(),job.IsFull);
         //if (spec != null)
         //{
         //    CurrentSpecs = spec;
         //    InitView();
         //}
     }
     //this.EnableScaner();
 }
コード例 #7
0
ファイル: CheckJob.cs プロジェクト: mirror4/TrainCheck
        public static JobMain Create(Int32 id)
        {
            JobMain result;

            if (id == 0)
            {
                result        = new JobMain();
                result.UserID = AppHelper.UserID;
                result.ID     = SaveJob(result);
            }
            else
            {
                result = FindJobMain(id);
            }
            return(result);
        }
コード例 #8
0
ファイル: FormCheck.cs プロジェクト: ddssssdd/TrainCheck
 public FormCheck(JobMain job)
     : this()
 {
     CurrentJob = job;
     if (job.Items.Count > 0)
     {
         //Int32 specsid = job.Items.Max(jobdetail => jobdetail.SpecsID);
         //Specs spec = DbFactory.FindByFilter("ID=" + specsid.ToString(),job.IsFull);
         //if (spec != null)
         //{
         //    CurrentSpecs = spec;
         //    InitView();
         //}
     }
     //this.EnableScaner();
 }
コード例 #9
0
ファイル: CheckJob.cs プロジェクト: mirror4/TrainCheck
        public static JobMain FindJobMainBySQL(String sqlString)
        {
            JobMain result = new JobMain();

            using (IDataReader dr = DataAccess.ExecuteReader(sqlString))
            {
                if (dr.Read())
                {
                    result.ID                = Int32.Parse(dr["ID"].ToString());
                    result.JobDate           = DateTime.Parse(dr["JobDate"].ToString());
                    result.UserID            = Int32.Parse(dr["UserID"].ToString());
                    result.BeginTime         = DateTime.Parse(dr["beginTime"].ToString());
                    result.EndTime           = (dr["EndTime"] == DBNull.Value) ? default(DateTime) : DateTime.Parse(dr["EndTime"].ToString());
                    result.IsUploaded        = (dr["IsUploaded"] == DBNull.Value) ? false : Boolean.Parse(dr["isUploaded"].ToString());
                    result.NeedCheckPosition = (dr["NeedCheckPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["NeedCheckPosition"].ToString());
                    result.CheckPosition     = (dr["CheckPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["CheckPosition"].ToString());
                    result.PassPosition      = (dr["PassPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["PassPosition"].ToString());
                    result.IsFull            = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    result.TrainCode         = (dr["TrainCode"] == DBNull.Value) ? "" : dr["TrainCode"].ToString();
                    dr.Close();
                }
                else
                {
                    return(null);
                }
            }
            using (IDataReader dr = DataAccess.ExecuteReader(String.Format("Select * from JobDetail where Jobid={0}", result.ID)))
            {
                while (dr.Read())
                {
                    JobDetail item = new JobDetail();
                    item.ID              = Int32.Parse(dr["ID"].ToString());
                    item.JobID           = result.ID;
                    item.SpecsID         = Int32.Parse(dr["SpecsID"].ToString());
                    item.CheckTime       = (dr["CheckTime"] == DBNull.Value) ? default(DateTime) : DateTime.Parse(dr["CheckTime"].ToString());
                    item.isChecked       = (dr["isChecked"] == DBNull.Value) ? false : Boolean.Parse(dr["isChecked"].ToString());
                    item.CheckDetailList = (dr["CheckDetailList"] == DBNull.Value) ? "" : dr["checkDetailList"].ToString();
                    item.BarCode         = (dr["BarCode"] == DBNull.Value) ? "" : dr["BarCode"].ToString();
                    result.Items.Add(item);
                }
                dr.Close();
            }
            return(result);
        }
コード例 #10
0
ファイル: CheckJob.cs プロジェクト: mirror4/TrainCheck
        public static int SaveJob(JobMain job)
        {
            StringBuilder sqlList = new StringBuilder();

            if (job.ID == 0)
            {
                int result = JobInsert(job);
                return(result);
            }
            else
            {
                foreach (JobDetail detail in job.Items)
                {
                    if (detail.ID > 0)
                    {
                        sqlList.AppendFormat(@"Update jobDetail set ischecked={0},checkTime='{1}',checkDetailList=
                                                                '{2}' where jobid={3} and specsID={4}    ",
                                             detail.isChecked ? 1 : 0,
                                             detail.CheckTime,
                                             detail.CheckDetailList,
                                             detail.JobID,
                                             detail.SpecsID);
                    }
                    else
                    {
                        sqlList.AppendFormat(@"Insert into jobDetail (jobid,specsID,checkTime,ischecked,checkdetailList)
                                               Values({0},{1},'{2}',{3},'{4}','{5}')      ",
                                             job.ID,
                                             detail.SpecsID,
                                             detail.CheckTime,
                                             detail.isChecked ? 1 : 0,
                                             detail.CheckDetailList,
                                             detail.BarCode);
                    }

                    DataAccess.ExecuteNonQuery(sqlList.ToString());
                }

                return(1);
            }
        }
コード例 #11
0
ファイル: CheckJob.cs プロジェクト: ddssssdd/TrainCheck
 public static int JobInsert(JobMain job)
 {
     string sqlstring = "select count(*) from DictSpecs";
     if (job.IsFull == false)
         sqlstring = "select count(*) from DictSpecs where isFull<>1";
     int needCheckcount = Int32.Parse(DataAccess.ExecuteScalar(sqlstring).ToString());
     sqlstring = String.Format(@"Insert into JobMain(jobdate,userid,begintime,isUploaded,NeedCheckPosition,CheckPosition,PassPosition,IsFull)
                                     Values(getdate(),{0},getdate(),0,{1},0,0,{2})", job.UserID,needCheckcount,job.IsFull?1:0);
     DataAccess.ExecuteNonQuery(sqlstring);
     int result = Int32.Parse(DataAccess.ExecuteScalar("Select max(id) from jobmain").ToString());
     job.ID = result;
     job.NeedCheckPosition = needCheckcount;
     return result;
 }
コード例 #12
0
ファイル: FormJobMainView.cs プロジェクト: mirror4/TrainCheck
 public FormJobMainView(JobMain job, String keyName) : this()
 {
     _keyName = keyName;
     _Job     = job;
     InitView();
 }
コード例 #13
0
ファイル: CheckJob.cs プロジェクト: mirror4/TrainCheck
        public static JobMain FindToDayJob()
        {
            JobMain result = FindJobMainBySQL(String.Format("select * from jobmain where NeedCheckPosition>CheckPosition and isuploaded=0 and Userid={0} and dateDiff(Day,jobDate,getdate())=0", AppHelper.UserID));

            return(result);
        }
コード例 #14
0
 public FormJobMainView(JobMain job)
     : this()
 {
     _Job = job;
     InitView();
 }
コード例 #15
0
ファイル: FormJobMainView.cs プロジェクト: mirror4/TrainCheck
 public FormJobMainView(JobMain job) : this()
 {
     _Job = job;
     InitView();
 }
コード例 #16
0
ファイル: CheckJob.cs プロジェクト: ddssssdd/TrainCheck
        public static JobMain FindJobMainBySQL(String sqlString)
        {
            JobMain result = new JobMain();
            using (IDataReader dr = DataAccess.ExecuteReader(sqlString))
            {
                if (dr.Read())
                {
                    result.ID = Int32.Parse(dr["ID"].ToString());
                    result.JobDate = DateTime.Parse(dr["JobDate"].ToString());
                    result.UserID = Int32.Parse(dr["UserID"].ToString());
                    result.BeginTime = DateTime.Parse(dr["beginTime"].ToString());
                    result.EndTime = (dr["EndTime"] == DBNull.Value) ? default(DateTime) : DateTime.Parse(dr["EndTime"].ToString());
                    result.IsUploaded = (dr["IsUploaded"] == DBNull.Value) ? false : Boolean.Parse(dr["isUploaded"].ToString());
                    result.NeedCheckPosition = (dr["NeedCheckPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["NeedCheckPosition"].ToString());
                    result.CheckPosition = (dr["CheckPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["CheckPosition"].ToString());
                    result.PassPosition = (dr["PassPosition"] == DBNull.Value) ? 0 : Int32.Parse(dr["PassPosition"].ToString());
                    result.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    result.TrainCode = (dr["TrainCode"] == DBNull.Value) ? "" : dr["TrainCode"].ToString();
                    dr.Close();
                }
                else
                    return null;

            }
            using (IDataReader dr = DataAccess.ExecuteReader(String.Format("Select * from JobDetail where Jobid={0}", result.ID)))
            {
                while (dr.Read())
                {
                    JobDetail item = new JobDetail();
                    item.ID = Int32.Parse(dr["ID"].ToString());
                    item.JobID = result.ID;
                    item.SpecsID = Int32.Parse(dr["SpecsID"].ToString());
                    item.CheckTime = (dr["CheckTime"] == DBNull.Value) ? default(DateTime) : DateTime.Parse(dr["CheckTime"].ToString());
                    item.isChecked = (dr["isChecked"] == DBNull.Value) ? false : Boolean.Parse(dr["isChecked"].ToString());
                    item.CheckDetailList = (dr["CheckDetailList"] == DBNull.Value) ? "" : dr["checkDetailList"].ToString();
                    item.BarCode = (dr["BarCode"] == DBNull.Value) ? "" : dr["BarCode"].ToString();
                    result.Items.Add(item);
                }
                dr.Close();
            }
            return result;
        }
コード例 #17
0
ファイル: CheckJob.cs プロジェクト: ddssssdd/TrainCheck
 public static bool DeleteJobMain(JobMain job)
 {
     int result = DataAccess.ExecuteNonQuery(String.Format("delete from jobdetail where jobid={0}", job.ID));
     result = DataAccess.ExecuteNonQuery(String.Format("delete from jobmain where id={0}", job.ID));
     return result > 0;
 }
コード例 #18
0
ファイル: CheckJob.cs プロジェクト: ddssssdd/TrainCheck
        public static int SaveJob(JobMain job)
        {
            StringBuilder sqlList = new StringBuilder();
            if (job.ID == 0)
            {
                int result = JobInsert(job);
                return result;

            }
            else
            {
                foreach (JobDetail detail in job.Items)
                {
                    if (detail.ID > 0)
                        sqlList.AppendFormat(@"Update jobDetail set ischecked={0},checkTime='{1}',checkDetailList=
                                                                '{2}' where jobid={3} and specsID={4}    ",
                                                                  detail.isChecked ? 1 : 0,
                                                                  detail.CheckTime,
                                                                  detail.CheckDetailList,
                                                                  detail.JobID,
                                                                  detail.SpecsID);
                    else
                        sqlList.AppendFormat(@"Insert into jobDetail (jobid,specsID,checkTime,ischecked,checkdetailList)
                                               Values({0},{1},'{2}',{3},'{4}','{5}')      ",
                                               job.ID,
                                               detail.SpecsID,
                                               detail.CheckTime,
                                               detail.isChecked ? 1 : 0,
                                               detail.CheckDetailList,
                                               detail.BarCode);

                    DataAccess.ExecuteNonQuery(sqlList.ToString());

                }

                return 1;
            }
        }