Пример #1
0
        public static void InitTabs()
        {
            C_Db.Exec("create table if not exists grims.well( " +
                      "id int auto_increment,                 " +       //0
                      "tsOrSt varchar(255),                   " +       //1
                      "village varchar(255),                  " +       //2
                      "unitCat varchar(255),                  " +       //3
                      "loc varchar(255),                      " +       //4
                      "lng varchar(255),                            " + //5
                      "lat varchar(255),                            " + //6
                      "usefor varchar(255),                   " +       //7
                      "digTime date,                  " +               //8
                      "wellDepth float,                     " +         //9
                      "tubeMat varchar(255),          " +               //10
                      "tubeIr float,                         " +        //11
                      "stanWaterDepth float,                  " +       //12
                      "saltWaterFloorDepth float,            " +        //13
                      "filterLocLow float,                    " +       //14
                      "filterLocHigh float,               " +           //15
                      "stillWaterLoc float,                      " +    //16

                      "pumpMode varchar(255),                     " +   //17
                      "pumpPower float,                     " +         //18
                      "coverArea float,                " +              //19
                      "supPeopleNum int,                       " +      //20
                      "isWaterLevelOp bool,                       " +   //21
                      "isMfInstalled bool,                       " +    //22
                      "linkWellNo int,                      " +         //23
                      "isSeepChnLinked bool,                   " +      //24
                      "seepChnLength float,                 " +         //25
                      "remark varchar(255),                " +          //26
                      "primary key(Id)                        " +
                      ")default charset = utf8mb4; ");
        }
Пример #2
0
 public static Tuple <E_DbRState, Exception> Change(C_EntWell well)
 {
     return(C_Db.Exec("update grims.entwell set TsOrSt='" + well.TsOrSt +
                      "', EntName='" + well.EntName +
                      "', UnitCat='" + well.UnitCat +
                      "', Loc='" + well.Loc +
                      "', Lng='" + well.Lng +
                      "', Lat='" + well.Lat +
                      "', Usefor='" + well.Usefor +
                      "', DigTime='" + well.DigTime.ToString("yyyy-MM-dd") +
                      "', FetchWaterId='" + well.FetchWaterId +
                      "', IsPaid=" + well.IsPaid +
                      ", WellDepth=" + well.WellDepth +
                      ", TubeMat='" + well.TubeMat +
                      "', TubeIr=" + well.TubeIr +
                      ", StanWaterDepth=" + well.StanWaterDepth +
                      ", SaltWaterFloorDepth=" + well.SaltWaterFloorDepth +
                      ", FilterLocLow=" + well.FilterLocLow +
                      ", FilterLocHigh=" + well.FilterLocHigh +
                      ", StillWaterLoc=" + well.StillWaterLoc +
                      ", PumpMode='" + well.PumpMode +
                      "', PumpPower=" + well.PumpPower +
                      ", IsWaterLevelOp=" + well.IsWaterLevelOp +
                      ", IsMfInstalled=" + well.IsMfInstalled +
                      ", Remark='" + well.Remark +
                      "' where Id = '" + well.Id + "';"
                      ));
 }
Пример #3
0
 public static void InitTabs()
 {
     C_Db.Exec("create table if not exists grims.entwell( " +
               "id int auto_increment,                 " +               //0
               "tsOrSt varchar(255),                   " +               //1
               "entName varchar(255),                  " +               //2
               "unitCat varchar(255),                  " +               //3
               "loc varchar(255),                      " +               //4
               "lng varchar(255),                            " +         //5
               "lat varchar(255),                            " +         //6
               "usefor varchar(255),                   " +               //7
               "digTime date,                  " +                       //8
               "fetchWaterId varchar(255),         " +                   //9
               "isPaid bool,         " +                                 //10
               "wellDepth float,                     " +                 //11
               "tubeMat varchar(255),          " +                       //12
               "tubeIr float,                         " +                //13
               "stanWaterDepth float,                  " +               //14
               "saltWaterFloorDepth float,            " +                //15
               "filterLocLow float,                    " +               //16
               "filterLocHigh float,               " +                   //17
               "stillWaterLoc float,                      " +            //18
               "pumpMode varchar(255),                     " +           //19
               "pumpPower float,                     " +                 //20
               "isWaterLevelOp bool,                       " +           //21
               "isMfInstalled bool,                       " +            //22
               "remark varchar(255),                " +                  //23
               "primary key(Id)                        " +
               ")default charset = utf8mb4; ");
 }
Пример #4
0
 public static Tuple <E_DbRState, Exception> Change(C_Well well)
 {
     return(C_Db.Exec("  update grims.well set " +
                      "TsOrSt             ='" + well.TsOrSt + "'," +
                      "Village            ='" + well.Village + "'," +
                      "UnitCat            ='" + well.UnitCat + "'," +
                      "Loc                ='" + well.Loc + "'," +
                      "Lng                ='" + well.Lng + "'," +
                      "Lat                ='" + well.Lat + "'," +
                      "Usefor             ='" + well.Usefor + "'," +
                      "DigTime            ='" + well.DigTime.ToString("yyyy-MM-dd") + "'," +
                      "WellDepth          =" + well.WellDepth + "," +
                      "TubeMat            ='" + well.TubeMat + "'," +
                      "TubeIr             =" + well.TubeIr + "," +
                      "StanWaterDepth     =" + well.StanWaterDepth + "," +
                      "SaltWaterFloorDepth=" + well.SaltWaterFloorDepth + "," +
                      "FilterLocLow       =" + well.FilterLocLow + "," +
                      "FilterLocHigh      =" + well.FilterLocHigh + "," +
                      "StillWaterLoc      =" + well.StillWaterLoc + "," +
                      "PumpMode           ='" + well.PumpMode + "'," +
                      "PumpPower          =" + well.PumpPower + "," +
                      "CoverArea          =" + well.CoverArea + "," +
                      "SupPeopleNum       =" + well.SupPeopleNum + "," +
                      "IsWaterLevelOp     =" + well.IsWaterLevelOp + "," +
                      "IsMfInstalled      =" + well.IsMfInstalled + "," +
                      "LinkWellNo         =" + well.LinkWellNo + "," +
                      "IsSeepChnLinked    =" + well.IsSeepChnLinked + "," +
                      "SeepChnLength      =" + well.SeepChnLength + "," +
                      "Remark             ='" + well.Remark + "'" +
                      " where Id = " + well.Id + "" +
                      ";"
                      ));
 }
Пример #5
0
        public static Tuple <E_DbRState, Exception> Add(C_User user)
        {
            string cmd = "insert into grims.user (name,pwd,deptId,tel,email) values('" + user.Name + "'" +
                         ",'" + user.Pwd +
                         "','" + C_DbTabDept.GetIdByName(user.DeptName).Item2 +
                         "','" + user.Tel +
                         "','" + user.Email +
                         "');";

            return(C_Db.Exec(cmd));
        }
Пример #6
0
 public static void InitTabs()
 {
     C_Db.Exec("create table if not exists grims.user(" +
               "id int auto_increment," +
               "name varchar(255) not null unique," +
               "pwd varchar(255) not null," +
               "deptId int not null," +
               "tel varchar(255)," +
               "email varchar(255)," +
               "primary key(id),foreign key(deptId) references grims.dept(id)" +
               ") default charset=utf8mb4;");
 }
Пример #7
0
        public static void InitTabs()
        {
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes;

            C_Db.Exec("create table if not exists grims.adminPwd(pwd varchar(255) not null) default charset=utf8mb4;");

            QRes = C_Db.Query("select * from grims.adminPwd;");
            if (QRes.Item1 == E_DbRState.Success)
            {
                if (!QRes.Item2.HasRows)
                {
                    C_Db.Exec("insert into grims.AdminPwd (pwd) values('" + C_Md5.GetHash("123456") + "');");
                }
            }
        }
Пример #8
0
        //OUT
        public static Tuple <E_DbRState, List <string>, Exception> Get()
        {
            List <string> res = new List <string>();
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes = C_Db.Query("select * from grims.dept;");

            if (QRes.Item1 == E_DbRState.Failed)
            {
                return(new Tuple <E_DbRState, List <string>, Exception>(QRes.Item1, null, QRes.Item3));
            }

            while (QRes.Item2.Read())
            {
                res.Add(QRes.Item2.GetString("deptName"));
            }
            return(new Tuple <E_DbRState, List <string>, Exception>(E_DbRState.Success, res, null));
        }
Пример #9
0
        public static Tuple <E_DbRState, Exception> ResetPwd(string oldPwd, string newPwd)
        {
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes = C_Db.Query("select * from grims.adminPwd;");

            if (QRes.Item1 == E_DbRState.Failed)
            {
                return(new Tuple <E_DbRState, Exception>(QRes.Item1, QRes.Item3));
            }
            QRes.Item2.Read();
            if (oldPwd == QRes.Item2.GetString("pwd"))
            {
                return(C_Db.Exec("update grims.adminPwd set pwd='" + newPwd + "';"));
            }
            else
            {
                return(new Tuple <E_DbRState, Exception>(E_DbRState.ErrorPwd, null));
            }
        }
Пример #10
0
        public static Tuple <E_DbRState, List <C_User>, Exception> Get()
        {
            List <C_User> res = new List <C_User>();
            C_User        tmp = new C_User();
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes = C_Db.Query("select grims.user.id,grims.user.pwd,grims.user.name,grims.dept.deptName,grims.user.tel,grims.user.email from grims.user left outer join grims.dept on grims.user.deptId = grims.dept.id ;");

            while (QRes.Item2.Read())
            {
                tmp.Id       = QRes.Item2.GetInt32("id");
                tmp.Name     = QRes.Item2.GetString("name");
                tmp.Pwd      = QRes.Item2.GetString("pwd");
                tmp.DeptName = QRes.Item2.GetString("deptName");
                tmp.Tel      = QRes.Item2.GetString("tel");
                tmp.Email    = QRes.Item2.GetString("email");
                res.Add(tmp);
            }
            return(new Tuple <E_DbRState, List <C_User>, Exception>(E_DbRState.Success, res, null));
        }
Пример #11
0
        public static Tuple <E_DbRState, string, Exception> GetIdByName(string name)
        {
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes = C_Db.Query("select * from grims.dept;");

            if (QRes.Item1 == E_DbRState.Failed)
            {
                return(new Tuple <E_DbRState, string, Exception>(QRes.Item1, null, QRes.Item3));
            }

            while (QRes.Item2.Read())
            {
                if (QRes.Item2.GetString("deptName") == name)
                {
                    return(new Tuple <E_DbRState, string, Exception>(E_DbRState.Success, QRes.Item2.GetString("id"), null));
                }
            }
            return(new Tuple <E_DbRState, string, Exception>(E_DbRState.Success, null, null));
        }
Пример #12
0
        public static Tuple <E_DbRState, Exception> Login(string pwd)
        {
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes = C_Db.Query("select * from grims.adminPwd;");

            if (QRes.Item1 == E_DbRState.Failed)
            {
                return(new Tuple <E_DbRState, Exception>(QRes.Item1, QRes.Item3));
            }

            QRes.Item2.Read();
            if (pwd == QRes.Item2.GetString("pwd"))
            {
                return(new Tuple <E_DbRState, Exception>(E_DbRState.Success, null));
            }
            else
            {
                return(new Tuple <E_DbRState, Exception>(E_DbRState.ErrorPwd, null));
            }
        }
Пример #13
0
        public static Tuple <E_DbRState, C_WellParas, Exception> Get()
        {
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes;
            List <C_WellPara> res = new List <C_WellPara>();

            QRes = C_Db.Query("select * from grims.wellpara;");

            if (QRes.Item1 == E_DbRState.Success)
            {
                while (QRes.Item2.Read())
                {
                    C_WellPara tmp = new C_WellPara();
                    tmp.Type  = (E_WellParaType)Enum.Parse(typeof(E_WellParaType), QRes.Item2.GetString("paraType"), true);
                    tmp.Value = QRes.Item2.GetString("paraValue");
                    res.Add(tmp);
                }
                C_WellParas wps = new C_WellParas(res);
                return(new Tuple <E_DbRState, C_WellParas, Exception>(QRes.Item1, wps, QRes.Item3));
            }
            else
            {
                return(new Tuple <E_DbRState, C_WellParas, Exception>(QRes.Item1, null, QRes.Item3));
            }
        }
Пример #14
0
        public static Tuple <E_DbRState, List <C_Well>, Exception> Get(string filter)
        {
            List <C_Well> res = new List <C_Well>();
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes;

            if (filter == null || filter == "")
            {
                QRes = C_Db.Query("select * from grims.well;");
            }
            else
            {
                QRes = C_Db.Query("select * from grims.well where (" +
                                  "TsOrSt                   LIKE '%" + filter + "%' OR " +
                                  "Village                  LIKE '%" + filter + "%' OR " +
                                  "UnitCat                  LIKE '%" + filter + "%' OR " +
                                  "Loc                      LIKE '%" + filter + "%' OR " +
                                  "Lng                      LIKE '%" + filter + "%' OR " +
                                  "Lat                      LIKE '%" + filter + "%' OR " +
                                  "Usefor                   LIKE '%" + filter + "%' OR " +
                                  "DigTime                  LIKE '%" + filter + "%' OR " +
                                  "WellDepth                LIKE '%" + filter + "%' OR " +
                                  "TubeMat                  LIKE '%" + filter + "%' OR " +
                                  "TubeIr                   LIKE '%" + filter + "%' OR " +
                                  "StanWaterDepth           LIKE '%" + filter + "%' OR " +
                                  "SaltWaterFloorDepth      LIKE '%" + filter + "%' OR " +
                                  "FilterLocLow             LIKE '%" + filter + "%' OR " +
                                  "FilterLocHigh            LIKE '%" + filter + "%' OR " +
                                  "StillWaterLoc            LIKE '%" + filter + "%' OR " +
                                  "PumpMode                 LIKE '%" + filter + "%' OR " +
                                  "PumpPower                LIKE '%" + filter + "%' OR " +
                                  "CoverArea                LIKE '%" + filter + "%' OR " +
                                  "SupPeopleNum             LIKE '%" + filter + "%' OR " +
                                  "IsWaterLevelOp           LIKE '%" + filter + "%' OR " +
                                  "IsMfInstalled            LIKE '%" + filter + "%' OR " +
                                  "LinkWellNo               LIKE '%" + filter + "%' OR " +
                                  "IsSeepChnLinked          LIKE '%" + filter + "%' OR " +
                                  "SeepChnLength            LIKE '%" + filter + "%' OR " +
                                  "Remark                   LIKE '%" + filter + "%' " +
                                  ");");
            }
            while (QRes.Item2.Read())
            {
                C_Well well = new C_Well();
                well.Id                  = QRes.Item2.GetInt32("Id");
                well.TsOrSt              = QRes.Item2.GetString("TsOrSt");
                well.Village             = QRes.Item2.GetString("Village");
                well.UnitCat             = QRes.Item2.GetString("UnitCat");
                well.Loc                 = QRes.Item2.GetString("Loc");
                well.Lng                 = QRes.Item2.GetString("Lng");//5
                well.Lat                 = QRes.Item2.GetString("Lat");
                well.Usefor              = QRes.Item2.GetString("Usefor");
                well.DigTime             = QRes.Item2.GetDateTime("DigTime");
                well.WellDepth           = QRes.Item2.GetFloat("WellDepth");
                well.TubeMat             = QRes.Item2.GetString("TubeMat");//10
                well.TubeIr              = QRes.Item2.GetFloat("TubeIr");
                well.StanWaterDepth      = QRes.Item2.GetFloat("StanWaterDepth");
                well.SaltWaterFloorDepth = QRes.Item2.GetFloat("SaltWaterFloorDepth");
                well.FilterLocLow        = QRes.Item2.GetFloat("FilterLocLow");
                well.FilterLocHigh       = QRes.Item2.GetFloat("FilterLocHigh");
                well.StillWaterLoc       = QRes.Item2.GetFloat("StillWaterLoc");
                well.PumpMode            = QRes.Item2.GetString("PumpMode");
                well.PumpPower           = QRes.Item2.GetFloat("PumpPower");
                well.CoverArea           = QRes.Item2.GetFloat("CoverArea");
                well.SupPeopleNum        = QRes.Item2.GetInt32("SupPeopleNum");
                well.IsWaterLevelOp      = QRes.Item2.GetBoolean("IsWaterLevelOp");
                well.IsMfInstalled       = QRes.Item2.GetBoolean("IsMfInstalled");
                well.LinkWellNo          = QRes.Item2.GetInt32("LinkWellNo");
                well.IsSeepChnLinked     = QRes.Item2.GetBoolean("IsSeepChnLinked");
                well.SeepChnLength       = QRes.Item2.GetFloat("SeepChnLength");
                well.Remark              = QRes.Item2.GetString("Remark");
                res.Add(well);
            }
            return(new Tuple <E_DbRState, List <C_Well>, Exception>(E_DbRState.Changed, res, null));
        }
Пример #15
0
 public static void InitTabs()
 {
     C_Db.Exec("create table if not exists grims.wellpara(paraType varchar(255),paraValue varchar(255) unique)default charset = utf8mb4;");
 }
Пример #16
0
 public static Tuple <E_DbRState, Exception> Delete(C_Well well)
 {
     return(C_Db.Exec("delete from grims.well where Id='" + well.Id.ToString() + "';"));
 }
Пример #17
0
 public static Tuple <E_DbRState, Exception> Delete(C_User user)
 {
     return(C_Db.Exec("delete from grims.user where id='" + user.Id.ToString() + "'"));
 }
Пример #18
0
 public static Tuple <E_DbRState, Exception> Change(C_User user)
 {
     return(C_Db.Exec("update grims.user set name='" + user.Name + "',pwd='" + user.Pwd + "',deptId='" + C_DbTabDept.GetIdByName(user.DeptName).Item2 + "',tel='" + user.Tel + "',email='" + user.Email + "' where id='" + user.Id + "';"));
 }
Пример #19
0
 //OUT
 public static Tuple <E_DbRState, Exception> Change(string oldDeptName, string newDeptName)
 {
     return(C_Db.Exec("update grims.dept set deptName='" + newDeptName + "' where deptName='" + oldDeptName + "';"));
 }
Пример #20
0
 public static Tuple <E_DbRState, Exception> Add(C_WellPara wellPara)
 {
     return(C_Db.Exec("insert into grims.wellpara (paraType,paraValue) values('" + wellPara.Type + "','" + wellPara.Value + "');"));
 }
Пример #21
0
        public static Tuple <E_DbRState, Exception> Add(List <C_Well> wells)
        {
            string cmd = "insert into grims.well (   TsOrSt," + //1
                         "Village," +                           //2
                         "UnitCat," +                           //3
                         "Loc," +                               //4
                         "Lng," +                               //5
                         "Lat," +                               //6
                         "Usefor," +                            //7
                         "DigTime," +                           //8
                         "WellDepth," +                         //9
                         "TubeMat," +                           //10
                         "TubeIr," +                            //11
                         "StanWaterDepth," +                    //12
                         "SaltWaterFloorDepth," +               //13
                         "FilterLocLow," +                      //14
                         "FilterLocHigh," +                     //15
                         "StillWaterLoc," +                     //16
                         "PumpMode," +                          //17
                         "PumpPower," +                         //18
                         "CoverArea," +                         //19
                         "SupPeopleNum," +                      //20
                         "IsWaterLevelOp," +                    //21
                         "IsMfInstalled," +                     //22
                         "LinkWellNo," +                        //23
                         "IsSeepChnLinked," +                   //24
                         "SeepChnLength," +                     //25
                         "Remark" +                             //26
                         ")values";
            string tmp;

            for (int i = 0; i < wells.Count; ++i)
            {
                tmp = "('" +
                      wells[i].TsOrSt + "','" +                        //1
                      wells[i].Village + "','" +                       //2
                      wells[i].UnitCat + "','" +                       //3
                      wells[i].Loc + "','" +                           //4
                      wells[i].Lng + "','" +                           //5
                      wells[i].Lat + "','" +                           //6
                      wells[i].Usefor + "','" +                        //7
                      wells[i].DigTime.ToString("yyyy-MM-dd") + "'," + //8
                      wells[i].WellDepth + ",'" +                      //9
                      wells[i].TubeMat + "'," +                        //10
                      wells[i].TubeIr + "," +                          //11
                      wells[i].StanWaterDepth + "," +                  //12
                      wells[i].SaltWaterFloorDepth + "," +             //13
                      wells[i].FilterLocLow + "," +                    //14
                      wells[i].FilterLocHigh + "," +                   //15
                      wells[i].StillWaterLoc + ",'" +                  //16
                      wells[i].PumpMode + "'," +                       //17
                      wells[i].PumpPower + "," +                       //18
                      wells[i].CoverArea + "," +                       //19
                      wells[i].SupPeopleNum + "," +                    //20
                      wells[i].IsWaterLevelOp + "," +                  //21
                      wells[i].IsMfInstalled + "," +                   //22
                      wells[i].LinkWellNo + "," +                      //23
                      wells[i].IsSeepChnLinked + "," +                 //24
                      wells[i].SeepChnLength + ",'" +                  //25
                      wells[i].Remark +                                //26
                      "')";
                if (i == wells.Count - 1)
                {
                    tmp += ";";
                }
                else
                {
                    tmp += ",";
                }
                cmd += tmp;
            }

            return(C_Db.Exec(cmd));
        }
Пример #22
0
 public static Tuple <E_DbRState, Exception> Change(C_WellPara oldWp, C_WellPara newWp)
 {
     return(C_Db.Exec("update grims.wellpara set paraType='" + newWp.Type + "' , paraValue='" + newWp.Value + "' where paraType='" + oldWp.Type + "' and paraValue='" + oldWp.Value + "';"));
 }
Пример #23
0
 public static Tuple <E_DbRState, Exception> Delete(C_WellPara wellPara)
 {
     return(C_Db.Exec("delete from grims.wellpara where paraType='" + wellPara.Type + "' and paraValue='" + wellPara.Value + "';"));
 }
Пример #24
0
 public static void InitTabs()
 {
     C_Db.Exec("create table if not exists grims.dept(id int auto_increment,deptName varchar(255) not null unique,primary key(id)) default charset=utf8mb4;");
 }
Пример #25
0
        public static Tuple <E_DbRState, List <C_EntWell>, Exception> Get(string filter)
        {
            List <C_EntWell> res = new List <C_EntWell>();
            Tuple <E_DbRState, MySqlDataReader, Exception> QRes;

            if (filter == null || filter == "")
            {
                QRes = C_Db.Query("select * from grims.entwell;");
            }
            else
            {
                QRes = C_Db.Query("select * from grims.entwell where (" +
                                  "TsOrSt                   LIKE '%" + filter + "%' OR " + //1
                                  "EntName                  LIKE '%" + filter + "%' OR " + //2
                                  "UnitCat                  LIKE '%" + filter + "%' OR " + //3
                                  "Loc                      LIKE '%" + filter + "%' OR " + //4
                                  "Lng                      LIKE '%" + filter + "%' OR " + //5
                                  "Lat                      LIKE '%" + filter + "%' OR " + //6
                                  "Usefor                   LIKE '%" + filter + "%' OR " + //7
                                  "DigTime                  LIKE '%" + filter + "%' OR " + //8

                                  "FetchWaterId             LIKE '%" + filter + "%' OR " + //9
                                  "IsPaid                   LIKE '%" + filter + "%' OR " + //10

                                  "WellDepth                LIKE '%" + filter + "%' OR " + //11
                                  "TubeMat                  LIKE '%" + filter + "%' OR " + //12
                                  "TubeIr                   LIKE '%" + filter + "%' OR " + //13
                                  "StanWaterDepth           LIKE '%" + filter + "%' OR " + //14
                                  "SaltWaterFloorDepth      LIKE '%" + filter + "%' OR " + //15
                                  "FilterLocLow             LIKE '%" + filter + "%' OR " + //16
                                  "FilterLocHigh            LIKE '%" + filter + "%' OR " + //17
                                  "StillWaterLoc            LIKE '%" + filter + "%' OR " + //18
                                  "PumpMode                 LIKE '%" + filter + "%' OR " + //19
                                  "PumpPower                LIKE '%" + filter + "%' OR " + //20
                                  "IsWaterLevelOp           LIKE '%" + filter + "%' OR " + //21
                                  "IsMfInstalled            LIKE '%" + filter + "%' OR " + //22
                                  "Remark                   LIKE '%" + filter + "%' " +
                                  ");");
            }
            while (QRes.Item2.Read())
            {
                C_EntWell well = new C_EntWell();
                well.Id      = QRes.Item2.GetInt32("Id");
                well.TsOrSt  = QRes.Item2.GetString("TsOrSt");
                well.EntName = QRes.Item2.GetString("EntName");
                well.UnitCat = QRes.Item2.GetString("UnitCat");
                well.Loc     = QRes.Item2.GetString("Loc");
                well.Lng     = QRes.Item2.GetString("Lng");//5
                well.Lat     = QRes.Item2.GetString("Lat");
                well.Usefor  = QRes.Item2.GetString("Usefor");
                well.DigTime = QRes.Item2.GetDateTime("DigTime");

                well.FetchWaterId = QRes.Item2.GetString("FetchWaterId");
                well.IsPaid       = QRes.Item2.GetBoolean("IsPaid");

                well.WellDepth           = QRes.Item2.GetFloat("WellDepth"); //11
                well.TubeMat             = QRes.Item2.GetString("TubeMat");  //12
                well.TubeIr              = QRes.Item2.GetFloat("TubeIr");
                well.StanWaterDepth      = QRes.Item2.GetFloat("StanWaterDepth");
                well.SaltWaterFloorDepth = QRes.Item2.GetFloat("SaltWaterFloorDepth");
                well.FilterLocLow        = QRes.Item2.GetFloat("FilterLocLow");//16
                well.FilterLocHigh       = QRes.Item2.GetFloat("FilterLocHigh");
                well.StillWaterLoc       = QRes.Item2.GetFloat("StillWaterLoc");
                well.PumpMode            = QRes.Item2.GetString("PumpMode");
                well.PumpPower           = QRes.Item2.GetFloat("PumpPower");//20
                well.IsWaterLevelOp      = QRes.Item2.GetBoolean("IsWaterLevelOp");
                well.IsMfInstalled       = QRes.Item2.GetBoolean("IsMfInstalled");
                well.Remark              = QRes.Item2.GetString("Remark");
                res.Add(well);
            }
            return(new Tuple <E_DbRState, List <C_EntWell>, Exception>(E_DbRState.Changed, res, null));
        }
Пример #26
0
 //OUT
 public static Tuple <E_DbRState, Exception> Delete(string deptName)
 {
     return(C_Db.Exec("delete from grims.dept where deptName='" + deptName + "';"));
 }
Пример #27
0
 //OUT
 public static Tuple <E_DbRState, Exception> Add(string deptName)
 {
     return(C_Db.Exec("insert into grims.dept (deptName) values('" + deptName + "');"));
 }
Пример #28
0
        public static Tuple <E_DbRState, Exception> Add(List <C_EntWell> wells)
        {
            string cmd = "insert into grims.entwell (   TsOrSt," + //1
                         "EntName," +                              //2
                         "UnitCat," +                              //3
                         "Loc," +                                  //4
                         "Lng," +                                  //5
                         "Lat," +                                  //6
                         "Usefor," +                               //7
                         "DigTime," +                              //8


                         "FetchWaterId," +                        //9
                         "IsPaid," +                              //10

                         "WellDepth," +                           //11
                         "TubeMat," +                             //12
                         "TubeIr," +                              //13
                         "StanWaterDepth," +                      //14
                         "SaltWaterFloorDepth," +                 //15
                         "FilterLocLow," +                        //16
                         "FilterLocHigh," +                       //17
                         "StillWaterLoc," +                       //18
                         "PumpMode," +                            //19
                         "PumpPower," +                           //20
                         "IsWaterLevelOp," +                      //21
                         "IsMfInstalled," +                       //22
                         "Remark" +                               //23
                         ")values";
            string tmp;

            for (int i = 0; i < wells.Count; ++i)
            {
                tmp = "('" +
                      wells[i].TsOrSt + "','" +                         //1
                      wells[i].EntName + "','" +                        //2
                      wells[i].UnitCat + "','" +                        //3
                      wells[i].Loc + "','" +                            //4
                      wells[i].Lng + "','" +                            //5
                      wells[i].Lat + "','" +                            //6
                      wells[i].Usefor + "','" +                         //7
                      wells[i].DigTime.ToString("yyyy-MM-dd") + "','" + //8

                      wells[i].FetchWaterId + "'," +                    //9
                      wells[i].IsPaid + "," +                           //10

                      wells[i].WellDepth + ",'" +                       //11
                      wells[i].TubeMat + "'," +                         //12
                      wells[i].TubeIr + "," +                           //13
                      wells[i].StanWaterDepth + "," +                   //14
                      wells[i].SaltWaterFloorDepth + "," +              //15
                      wells[i].FilterLocLow + "," +                     //16
                      wells[i].FilterLocHigh + "," +                    //17
                      wells[i].StillWaterLoc + ",'" +                   //18
                      wells[i].PumpMode + "'," +                        //19
                      wells[i].PumpPower + "," +                        //20
                      wells[i].IsWaterLevelOp + "," +                   //21
                      wells[i].IsMfInstalled + ",'" +                   //22
                      wells[i].Remark +                                 //23
                      "')";
                if (i == wells.Count - 1)
                {
                    tmp += ";";
                }
                else
                {
                    tmp += ",";
                }
                cmd += tmp;
            }

            return(C_Db.Exec(cmd));
        }