示例#1
0
        public int InsertAccount(Model.Criteria.M_AccountCriteria criteria)
        {
            try
            {
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Insert into account ( ";
                sql += "title,";
                sql += "name,";
                sql += "surname,";
                sql += "username,";
                sql += "password,";
                sql += "level,";
                sql += "signature,";
                sql += " email) VALUES(";
                sql += "'" + criteria.title + "',";
                sql += "'" + criteria.name + "',";
                sql += "'" + criteria.surname + "',";
                sql += "'" + criteria.username + "',";
                sql += "'" + criteria.password + "',";
                sql += "'" + criteria.level + "',";
                sql += "'" + criteria.signature + "',";
                sql += "'" + criteria.email + "')";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#2
0
 public int UpdateAccount(Model.Criteria.M_AccountCriteria criteria)
 {
     try
     {
         Class.clsDB db = new Class.clsDB();
         string      sql;
         sql  = "Update account SET ";
         sql += "title='" + criteria.title + "',";
         sql += "name='" + criteria.name + "',";
         sql += "surname='" + criteria.surname + "',";
         sql += "username='******',";
         sql += "password='******',";
         sql += "level='" + criteria.level + "',";
         sql += "signature='" + criteria.signature + "' WHERE ";
         sql += " email='" + criteria.email + "'";
         int ret;
         ret = db.ExecuteNonQuery(sql);
         db.Close();
         return(ret);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#3
0
文件: Data.cs 项目: hoolanla/VMS
        public DataTable Update_Data(MODEL.Data criteria)
        {
            try
            {
                criteria.update_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                criteria.out_time    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Update vm_visitor SET flag_out='1',  ";
                sql += "out_time='" + criteria.out_time + "',";
                sql += "update_date='" + criteria.update_date + "' Where vm_id='" + criteria.vm_id + "'";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();
                if (ret == 1)
                {
                    DataTable dt;
                    sql = "Select * From vm_visitor Where vm_id = '" + criteria.vm_id + "'";
                    dt  = db.ExecuteDataTable(sql);
                    return(dt);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#4
0
        public List <Model.Document> getAll_Document(Model.Criteria.Document criteria)
        {
            //string connStr = Properties.Settings.Default.InventoryControl_ConnectionString;
            //SqlConnection conn = Common.DataHelper.getSQLServerConnectionObject(connStr);
            DataSet ds = new DataSet();
            String  sql;

            sql = "Select * From document where doc_id=" + criteria.doc_id;
            Class.clsDB db = new Class.clsDB();
            ds = db.ExecuteDataSet(sql);
            db.Close();
            //SqlDataAdapter adp = new SqlDataAdapter("usp_Permission_Read", conn);
            //adp.SelectCommand.CommandType = CommandType.StoredProcedure;
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PRJ_Code", criteria.PRJ_Code));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@UserAccount", criteria.UserAccount));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PAG_Code", criteria.PAG_Code));
            //  adp.Fill(ds);

            return(ds.Tables[0].AsEnumerable().Select(s => new Model.Document
            {
                doc_id_int = s.Field <int>("doc_id"),
                doc_name = s.Field <string>("doc_name"),
                secure_approve = s.Field <string>("secure_approve"),
                secure_prepare = s.Field <string>("secure_prepare"),
                approve_problem = s.Field <string>("approve_problem"),
                content = s.Field <string>("content")
            }).ToList());
        }
示例#5
0
文件: Data.cs 项目: hoolanla/VMS
        public string getRuningNoDoc()
        {
            //Format yyyyMMdd-01   2018011501
            Class.clsDB db  = new Class.clsDB();
            string      sql = null;
            string      curDate;

            curDate = DateTime.Now.ToString("yyyyMMdd");
            sql     = "Select vm_id From vm_visitor where vm_id like '" + curDate + "%'";
            object    MyScalar = null;
            DataTable dt;

            dt = db.ExecuteDataTable(sql);
            db.Close();

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    sql      = "Select Max(vm_id) + 1 From vm_visitor";
                    MyScalar = db.ExecuteScalar(sql);
                    return(MyScalar.ToString());
                }
                else
                {
                    return(curDate.ToString() + "01");
                }
            }

            return(curDate);
        }
示例#6
0
文件: job.cs 项目: hoolanla/C-TMS
        public int GetStatus_Barcode(string barcode)
        {
            Class.clsDB db  = new Class.clsDB();
            string      sql = "Select * From job_trailer WHERE job_id ='" + barcode + "'";
            DataTable   dt;

            dt = db.ExecuteDataTable(sql);
            db.Close();
            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0].IsNull("timestamp1"))
                {
                    return(1);
                }
                else if ((!dt.Rows[0].IsNull("timestamp1")) && (!dt.Rows[0].IsNull("timestamp2")) && (!dt.Rows[0].IsNull("timestamp3")))
                {
                    return(3);
                }
                else if ((!dt.Rows[0].IsNull("timestamp1")) && (!dt.Rows[0].IsNull("timestamp2")))
                {
                    return(2);
                }
            }

            return(0);
        }
示例#7
0
        public List <Model.Account> getEmail_Level2()
        {
            //string connStr = Properties.Settings.Default.InventoryControl_ConnectionString;
            //SqlConnection conn = Common.DataHelper.getSQLServerConnectionObject(connStr);
            DataSet ds = new DataSet();
            String  sql;

            sql = "Select * From account where level='2'";
            Class.clsDB db = new Class.clsDB();
            ds = db.ExecuteDataSet(sql);
            db.Close();
            //SqlDataAdapter adp = new SqlDataAdapter("usp_Permission_Read", conn);
            //adp.SelectCommand.CommandType = CommandType.StoredProcedure;
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PRJ_Code", criteria.PRJ_Code));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@UserAccount", criteria.UserAccount));
            //adp.SelectCommand.Parameters.Add(new SqlParameter("@PAG_Code", criteria.PAG_Code));
            //  adp.Fill(ds);

            return(ds.Tables[0].AsEnumerable().Select(s => new Model.Account
            {
                Title = s.Field <string>("Title"),
                Name = s.Field <string>("Name"),
                Surname = s.Field <string>("Surname"),
                Email = s.Field <string>("Email"),
            }).ToList());
        }
示例#8
0
文件: job.cs 项目: hoolanla/C-TMS
        public int Insert_Job(MODEL.Criteria.job criteria)
        {
            try
            {
                criteria.createdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Insert into job_trailer ( ";
                sql += "job_id,";
                sql += "job_name,";
                sql += "job_date,";
                sql += "place_type,";
                sql += "create_by ,";
                sql += "create_date) VALUES(";
                sql += "'" + criteria.job_id + "',";
                sql += "'" + criteria.job_name + "',";
                sql += "'" + criteria.job_date + "',";
                sql += "'" + criteria.place_type + "',";
                sql += "'" + criteria.createby + "',";
                sql += "'" + criteria.createdate + "')";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();

                return(ret);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#9
0
        public string InsertDocument_step1(Model.Criteria.Document criteria)
        {
            Class.clsDB db = new Class.clsDB();
            string      sql;

            sql  = "Insert into document(";
            sql += "doc_id,";
            sql += "doc_name,";
            sql += "create_by,";
            sql += "content,";
            sql += "supplier_id,";
            sql += "supplier_name,";
            sql += "attach_file_name,";
            sql += "comment,";
            sql += "secure_prepare) Values(";
            sql += "'" + criteria.doc_id + "',";
            sql += "'" + criteria.doc_name + "',";
            sql += "'" + criteria.create_by + "',";
            sql += "'" + criteria.content + "',";
            sql += "'" + criteria.suplier_id + "',";
            sql += "'" + criteria.supplier_name + "',";
            sql += "'" + criteria.attach_file_name + "',";
            sql += "'" + criteria.comment + "',";
            sql += "'" + criteria.secure_prepare + "')";



            int ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();

            return(ret.ToString());
        }
示例#10
0
        public void InsertFilename(string filename)
        {
            Class.clsDB db  = new Class.clsDB();
            string      sql = "insert into tb_file_name(file_name) values('" + filename + "')";

            db.ExecuteNonQuery(sql);
            db.Close();
        }
示例#11
0
        public void WriteLog(MODEL.Log log)
        {
            Class.clsDB db  = new Class.clsDB();
            string      sql = "Insert into log(create_by,content,ip_address,page) Values(";

            sql += "'" + log.create_by + "','" + log.content + "','" + log.ip + "','" + log.page + "')";
            db.ExecuteNonQuery(sql);
            db.Close();
        }
示例#12
0
        public void WriteLog(Model.Log log)
        {
            Class.clsDB db  = new Class.clsDB();
            string      sql = "Insert into log(create_by,content) Values(";

            sql += "'" + log.create_by + "','" + log.content + "')";
            db.ExecuteNonQuery(sql);
            db.Close();
        }
示例#13
0
文件: job.cs 项目: hoolanla/C-TMS
        public DataTable getData_ReportJob(string job_id)
        {
            DataTable dt  = null;
            string    sql = "Select * From vw_JobTrailer where job_id='" + job_id + "' and show_=1";

            Class.clsDB db = new Class.clsDB();
            dt = db.ExecuteDataTable(sql);
            db.Close();

            return(dt);
        }
示例#14
0
文件: job.cs 项目: hoolanla/C-TMS
        public DataTable getData_ReportJobTimestamp(string job_id)
        {
            DataTable dt  = null;
            string    sql = "Select job_id,job_name,job_date,time(timestamp1) as timestamp1,";

            sql += "time(timestamp2) as timestamp2,time(timestamp3) as timestamp3,time(timestamp4) as timestamp4";
            sql += " From job_trailer where job_id='" + job_id + "' and show_=1";
            Class.clsDB db = new Class.clsDB();
            dt = db.ExecuteDataTable(sql);
            db.Close();

            return(dt);
        }
示例#15
0
        public int Update_AttachFile(Model.Criteria.Document criteria, int val)
        {
            string sql;

            sql  = "Update document SET attach_file_name = " + val;
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
示例#16
0
        public int Update_sign_approve_problem(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update document SET approve_problem = '" + criteria.approve_problem + "',step4=1 ";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
示例#17
0
        public int Update_send_mail_Review(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update document SET send_mail_approve_date = '" + criteria.send_mail_approve_date + "',step3=1,secure_approve='" + criteria.secure_approve + "'";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
示例#18
0
        public int Update_sign_review_date(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update document SET sign_prepare_date = '" + criteria.sign_prepare_date + "',step2=1 ";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
示例#19
0
        public int Update_Upload_date(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Update document SET upload_date = '" + criteria.upload_date + "',";
            sql += "step1='1',page_count = " + criteria.page_count + ",paper_type = '" + criteria.paper_type + "'";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();
            return(ret);
        }
示例#20
0
        public int Delete_Document(Model.Criteria.Document criteria)
        {
            string sql;

            sql  = "Delete From document ";
            sql += " WHERE doc_id='" + criteria.doc_id + "'";

            Class.clsDB db = new Class.clsDB();
            int         ret;

            ret = db.ExecuteNonQuery(sql);
            db.Close();

            return(ret);
        }
示例#21
0
文件: Data.cs 项目: hoolanla/VMS
        public int Insert_Data(MODEL.Data criteria)
        {
            try
            {
                criteria.create_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                criteria.in_time     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Insert into vm_visitor ( ";
                sql += "vm_id,";
                sql += "name,";
                sql += "lastname,";
                sql += "birthday,";
                sql += "address ,";
                sql += "company ,";
                sql += "contact_person ,";
                sql += "dept ,";
                sql += "id_card ,";
                sql += "license_plate ,";
                sql += "create_by ,";
                sql += "in_time ,";
                sql += "create_date) VALUES(";
                sql += "'" + criteria.vm_id + "',";
                sql += "'" + criteria.name + "',";
                sql += "'" + criteria.lastname + "',";
                sql += "'" + criteria.birth + "',";
                sql += "'" + criteria.address + "',";
                sql += "'" + criteria.company + "',";
                sql += "'" + criteria.contact_person + "',";
                sql += "'" + criteria.dept + "',";
                sql += "'" + criteria.id_card + "',";
                sql += "'" + criteria.license_plate + "',";
                sql += "'" + criteria.create_by + "',";
                sql += "'" + criteria.in_time + "',";
                sql += "'" + criteria.create_date + "')";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();

                return(ret);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#22
0
        public bool InsertSupplier(List <Model.Supplier> lstSupp)
        {
            int k;

            k = lstSupp.Count();

            for (int i = 0; i < k; i++)
            {
                string         sql    = null;
                Model.Supplier m_supp = new Model.Supplier();
                m_supp = (Model.Supplier)lstSupp[i];

                sql += "Insert into supplier(supp_company,";
                sql += "supp_code,";
                sql += "supp_name,";
                sql += "supp_short_name,";
                sql += "supp_address_1,";
                sql += "supp_address_2,";
                sql += "supp_contact_person,";
                sql += "supp_contact_position) Values('";
                sql += m_supp.supp_company + "','";
                sql += m_supp.supp_code + "','";
                sql += m_supp.supp_name + "','";
                sql += m_supp.supp_short_name + "','";
                sql += m_supp.supp_address_1 + "','";
                sql += m_supp.supp_address_2 + "','";
                sql += m_supp.supp_contact_person + "','";
                sql += m_supp.supp_contact_position + "')";



                try
                {
                    Class.clsDB db = new Class.clsDB();
                    int         ret;
                    ret = db.ExecuteNonQuery(sql);
                    db.Close();
                }
                catch
                {
                }
            }



            return(true);
        }
示例#23
0
文件: job.cs 项目: hoolanla/C-TMS
 public int Update_stamp2(string appointed_time, string job_id)
 {
     try
     {
         Class.clsDB db = new Class.clsDB();
         string      sql;
         sql = "Update job_trailer SET timestamp2='" + appointed_time + "' Where job_id='" + job_id + "'";
         int ret;
         ret = db.ExecuteNonQuery(sql);
         db.Close();
         return(ret);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#24
0
文件: job.cs 项目: hoolanla/C-TMS
 public int Update_stamp4(string job_id)
 {
     try
     {
         Class.clsDB db = new Class.clsDB();
         string      sql;
         string      timestamp1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
         sql = "Update job_trailer SET timestamp4='" + timestamp1 + "' Where job_id='" + job_id + "'";
         int ret;
         ret = db.ExecuteNonQuery(sql);
         db.Close();
         return(ret);
     }
     catch (Exception ex)
     {
         return(0);
     }
 }
示例#25
0
文件: job.cs 项目: hoolanla/C-TMS
        public List <MODEL.jobDetail> getJobDetail(MODEL.Criteria.jobDetail criteria)
        {
            DataSet ds = new DataSet();
            String  sql;

            sql = "Select * From job_detail where show_=1";
            Class.clsDB db = new Class.clsDB();
            ds = db.ExecuteDataSet(sql);
            db.Close();

            return(ds.Tables[0].AsEnumerable().Select(s => new MODEL.jobDetail
            {
                job_id = s.Field <string>("job_id"),
                //place_get_job = s.Field<string>("place_get_job"),
                //container_type = s.Field<string>("container_type"),
                //container_dim = s.Field<string>("container_dim"),
            }).ToList());
        }
示例#26
0
文件: job.cs 项目: hoolanla/C-TMS
        public int Insert_JobDetail(MODEL.Criteria.jobDetail criteria)
        {
            try
            {
                Class.clsDB db = new Class.clsDB();
                string      sql;
                sql  = "Insert into job_trailer_detail ( ";
                sql += "job_id,";
                sql += "job_name,";
                sql += "place_get_job ,";
                sql += "container_type,";
                sql += "container_dim,";
                sql += "cust_dest,";
                sql += "code_name ,";
                sql += "appointed_time,";
                sql += "doc_no,";
                sql += "place_send_job,";
                sql += "send_company,";
                sql += "place_type,";
                sql += "remark) VALUES('";
                sql += criteria.job_id + "',";
                sql += "'" + criteria.job_name + "',";
                sql += "'" + criteria.place_get_job + "',";
                sql += "'" + criteria.container_type + "',";
                sql += "'" + criteria.container_dim + "',";
                sql += "'" + criteria.cust_dest + "',";
                sql += "'" + criteria.code_name + "',";
                sql += "'" + criteria.appointed_time + "',";
                sql += "'" + criteria.doc_no + "',";
                sql += "'" + criteria.place_send_job + "',";
                sql += "'" + criteria.send_company + "',";
                sql += "'" + criteria.place_type + "',";
                sql += "'" + criteria.remark + "')";

                int ret;
                ret = db.ExecuteNonQuery(sql);
                db.Close();
                return(ret);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
示例#27
0
        public DataTable GetCustomer()
        {
            DataTable table;

            try
            {
                DataSet     set    = new DataSet();
                string      strSQL = "Select * From supplier order by supp_short_name ";
                Class.clsDB sdb1   = new Class.clsDB();
                set = sdb1.ExecuteDataSet(strSQL);
                sdb1.Close();
                table = set.Tables[0];
            }
            catch (Exception exception1)
            {
                throw exception1;
            }
            return(table);
        }
示例#28
0
        public string Get_Paper_type(string doc_id)
        {
            Class.clsDB db = new Class.clsDB();
            string      sql;

            sql = " Select paper_type From document where doc_id=" + doc_id;
            DataTable dt;

            dt = db.ExecuteDataTable(sql);
            db.Close();
            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][0].ToString());
            }
            else
            {
                return("");
            }
        }
示例#29
0
        public DataTable ExecuteDatatable(string sql)
        {
            try
            {
                DataSet ds = new DataSet();

                Class.clsDB db = new Class.clsDB();
                ds = db.ExecuteDataSet(sql);
                db.Close();
                return(ds.Tables[0]);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
        }
示例#30
0
        public List <Model.Account> getEmail_Level0()
        {
            DataSet ds = new DataSet();
            String  sql;

            sql = "Select * From account where level='0'";
            Class.clsDB db = new Class.clsDB();
            ds = db.ExecuteDataSet(sql);
            db.Close();


            return(ds.Tables[0].AsEnumerable().Select(s => new Model.Account
            {
                Title = s.Field <string>("Title"),
                Name = s.Field <string>("Name"),
                Surname = s.Field <string>("Surname"),
                Email = s.Field <string>("Email"),
            }).ToList());
        }