Ejemplo n.º 1
0
        public down_modal()
        {
            InitializeComponent();
            CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern    = "yyyy'-'MM'-'dd";
            ci.DateTimeFormat.LongTimePattern     = "hh':'mm";
            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            DBhelper.EstablishConn();
            FillOnbehalf();
            FillSubjects();
        }
Ejemplo n.º 2
0
        public void GetTagSql(int tag)
        {
            string result = "请维护Tagsql";

            SqlDataReader dr = DBhelper.ExecuteReader("select [gridColumn], [Sql] from [CIAUTOTEXTSQL] where [tag]=" + tag);

            if (dr.Read())
            {
                result         = dr["sql"].ToString();
                this.ColumnXML = dr["gridColumn"].ToString();
            }
            this.tagSqlStr2 = result;
            SetCol();
        }
Ejemplo n.º 3
0
 public void DuiJiaoXianQuery(String queryLaTeX, Dictionary <String, List <Number> >[][] DataBase, Dictionary <String, int> dictionary2)
 {
     //矩阵对角线上的元素
     foreach (var it in DataBase[dictionary2[queryLaTeX]][dictionary2[queryLaTeX]]["#"])
     {
         String  sqlstr = "select * from 第一篇论文里面的实验数据 where 序号 = '" + it.number + "'";//where 数学公式 = 'z=\\frac{a}{b}*x' or 数学公式 = '\\frac{a}{b}'
         DataSet ds     = new DataSet();
         ds = DBhelper.GetDataSet(sqlstr);
         foreach (DataRow row in ds.Tables[0].Rows)
         {
             Console.WriteLine(row["数学公式"].ToString().Trim());
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 查询个人操作
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public DataTable QueryPersonalAction(string key)
        {
            string sql = @"SELECT Value FROM dbo.PersonalAction WHERE [Key]=@key";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@key", SqlDbType.NVarChar)
                {
                    Value = key
                }
            };

            return(DBhelper.ExecuteDataTable(sql, param));
        }
Ejemplo n.º 5
0
        public fault_modal()
        {
            InitializeComponent();
            CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern    = "yyyy'-'MM'-'dd";
            ci.DateTimeFormat.LongTimePattern     = "hh':'mm";
            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            DBhelper.EstablishConn();
            FillOnbehalf();
            FillPositions();
            FillConsoleNumber();
            Fillsystem_equipment();
        }
Ejemplo n.º 6
0
        public IActionResult Index(LoginModel model)
        {
            User user = DBhelper.CheckIfUserExists(model.Email, model.Password, "User");

            if (user.Email != "")
            {
                HttpContext.Session.Clear();
                HttpContext.Session.SetString("User", JsonConvert.SerializeObject(user));
                return(RedirectToAction("Index", "Feed"));
            }
            else
            {
                return(RedirectToAction("CouldNotLogIn", "Home"));
            }
        }
        public int Post(DailyItem daily)
        {
            //string sql = "insert into Daily Values('早睡',1,0,0)";
            string sql = string.Format("insert into Daily Values('{0}',{1},{2},'{3}','{4}','{5}',{6})",
                                       daily.Name,
                                       daily.Days,
                                       daily.AbandonCount,
                                       daily.Status,
                                       DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                       DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
                                       0);
            int i = DBhelper.Init().GetDataBase().Execute(sql);

            return(i);
        }
Ejemplo n.º 8
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string id  = this.dataGridView1.SelectedRows[0].Cells["KuCID"].Value.ToString();
            string sql = "delete from Stock where KuCID=" + id;
            bool   r   = DBhelper.BuCha(sql);

            if (r)
            {
                MessageBox.Show("删除成功!");
            }
            else
            {
                MessageBox.Show("删除失败!");
            }
        }
Ejemplo n.º 9
0
    public static string TSGetUserCompanyByID(string id) //get user name from account table according to user id
    {
        DBhelper  dbhelper = new DBhelper();
        string    sc       = "SELECT company, trading_name FROM card WHERE id='" + id + "'";
        DataTable dt       = dbhelper.ExecuteDataTable(sc);
        int       rows     = dt.Rows.Count;

        if (rows > 0)
        {
            return(dt.Rows[0]["trading_name"].ToString());
        }


        return("user not found");
    }
Ejemplo n.º 10
0
    /// <summary>
    /// 获得EnumId
    /// </summary>
    /// <param name="sClass"> enum表class字段 例如:card_type</param>
    /// <param name="sValue"> enum表name字段 例如:dealer</param>
    /// <returns>返回enum id</returns>
    public static string GetEnumID(string sClass, string sValue)
    {
        DataSet      dsEnum   = new DataSet();
        HttpResponse Response = HttpContext.Current.Response;
        DBhelper     dbhelper = new DBhelper();
        string       sc       = "SELECT id FROM enum WHERE class=@class AND name=@name";
        SqlCommand   cmd      = dbhelper.GetSqlStringCommond(sc);

        dbhelper.AddInParameter(cmd, "@class", sClass);
        dbhelper.AddInParameter(cmd, "@name", sValue);
        DataTable enumTable = dbhelper.ExecuteDataTable(cmd);

        string sID = enumTable.Rows[0]["id"].ToString();

        return(sID);
    }
Ejemplo n.º 11
0
        private void UpdateForm_Load_1(object sender, EventArgs e)
        {
            //将选中的值显示在修改框里
            this.txtPwd.Text     = sc.SelectedRows[0].Cells["StaffPwd"].Value.ToString();
            this.txtName.Text    = sc.SelectedRows[0].Cells["StaffName"].Value.ToString();
            this.txtAge.Text     = sc.SelectedRows[0].Cells["StaffAge"].Value.ToString();
            this.combSex.Text    = sc.SelectedRows[0].Cells["StaffSex"].Value.ToString();
            this.combDept.Text   = sc.SelectedRows[0].Cells["StaffDept"].Value.ToString();
            this.combType.Text   = sc.SelectedRows[0].Cells["StafftType"].Value.ToString();
            this.txtAddress.Text = sc.SelectedRows[0].Cells["StaffAddressed"].Value.ToString();
            this.txtSalay.Text   = sc.SelectedRows[0].Cells["StaffSalay"].Value.ToString();
            this.txtPhone.Text   = sc.SelectedRows[0].Cells["StaffPhone"].Value.ToString();
            string sql = "select * from Staff";

            this.sc.DataSource = DBhelper.Cha(sql).Tables[0];
        }
Ejemplo n.º 12
0
        public aman_modal()
        {
            InitializeComponent();
            CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern    = "yyyy'-'MM'-'dd";
            ci.DateTimeFormat.LongTimePattern     = "hh':'mm";
            Thread.CurrentThread.CurrentCulture   = ci;
            Thread.CurrentThread.CurrentUICulture = ci;
            DBhelper.EstablishConn();
            txinitial.Text = DBhelper.credsUser;
            FillOnbehalf();
            FillSubjects();
            FillRate();
            // GetClosetime();
        }
Ejemplo n.º 13
0
        public static bool Del_goods_by_goodsId(string goods_id)
        {
            //DBhelper help = new DBhelper();
            //string cmd = string.Format("delete from goods where goods_id = '{0}'", goods_id);
            //return help.updateDate(cmd) > 0;
            ArrayList arr  = new ArrayList();
            string    cmd1 = string.Format("delete from goods where goods_id = '{0}'", goods_id);
            string    cmd2 = string.Format("delete from entry where goodsid = '{0}'", goods_id);
            string    cmd3 = string.Format("delete from come where goodsid = '{0}'", goods_id);

            arr.Add(cmd1);
            arr.Add(cmd2);
            arr.Add(cmd3);
            DBhelper help = new DBhelper();

            return(help.MultiTrans(arr));
        }
Ejemplo n.º 14
0
        public IActionResult Dislike(int count)
        {
            string json = HttpContext.Session.GetString("User");

            Object objectuser = JsonConvert.DeserializeObject(json);

            ViewBag.user = objectuser;
            var user = ViewBag.user;

            string id = user.Id;

            var document = DBhelper.SearchForDocument(count, "Posts");

            DBhelper.AddDislike(document, id, "Posts");

            return(RedirectToAction("Index", "Feed"));
        }
Ejemplo n.º 15
0
 public bool checkuser(UserBean u)
 {
     if (!u.isempty())
     {
         return(false);
     }
     if (DBhelper.queryuserinfo(u))
     {
         MessageBox.Show("检查通过!");
         return(true);
     }
     else
     {
         MessageBox.Show("检查有问题!");
         return(false);
     }
 }
Ejemplo n.º 16
0
 public bool Authenticatefake(string email,ref string response)
 {
     string retorno = string.Empty;
     try
     {
         DBhelper db = new DBhelper(@"C:\Database\Database");
         String query = String.Format(@" select matricula from estilos where contatoPessoa='{0}'", email);
         retorno = db.ExecuteScalar(query);
         response = retorno;
     }
     catch (Exception fail)
     {
         String error = "The following error has occurred:\n\n";
         error += fail.Message.ToString() + "\n\n";
     }
     if (retorno == string.Empty) return false;
     return true;
 }
Ejemplo n.º 17
0
        /// <summary>
        /// 设置私人操作
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void SetPersonalAction(string key, string value)
        {
            string sql = @"UPDATE dbo.PersonalAction SET Value=@value WHERE [Key]=@key";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@key", SqlDbType.NVarChar)
                {
                    Value = key
                }
                , new SqlParameter("@value", SqlDbType.NVarChar)
                {
                    Value = value
                }
            };

            DBhelper.ExecuteNonQuery(sql, param);
        }
Ejemplo n.º 18
0
        public int Update()
        {
            DBhelper   dbhelper = new DBhelper();
            SqlCommand cmd      = new SqlCommand(UpdateCommand());

            cmd.Parameters.AddWithValue("@ID", this.ID);
            cmd.Parameters.AddWithValue("@Name", this.Name);
            cmd.Parameters.AddWithValue("@Price", this.Price);
            cmd.Parameters.AddWithValue("@Amount", this.Amount);
            cmd.Parameters.AddWithValue("@Status", this.Status);
            cmd.Parameters.AddWithValue("@Date", this.Date);
            cmd.Parameters.AddWithValue("@Pay", this.Pay);
            cmd.Parameters.AddWithValue("@Transfer", this.Transfer);
            cmd.Parameters.AddWithValue("@Deliver", this.Deliver);
            int count = dbhelper.ExecuteNonQuery(cmd);

            return(count);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 插入自动排名
        /// </summary>
        /// <param name="No">自动排名编号</param>
        /// <returns>返回受影响的行数</returns>
        public int InsertAutoBid(int No)
        {
            string sql = @"INSERT INTO dbo.AutomaticBid
            ( Ranking, RankTime )
            VALUES  (@No, -- Ranking - int
            GETDATE()  -- RankTime - datetime
            )";

            SqlParameter[] param = new SqlParameter[]
            {
                new SqlParameter("@No", SqlDbType.Int)
                {
                    Value = No
                }
            };

            return(DBhelper.ExecuteNonQuery(sql, param));
        }
Ejemplo n.º 20
0
        public static bool Update_User_msg(User user)
        {
            DBhelper help = new DBhelper();
            string   cmd  = string.Format("update sys_user "
                                          + "set username = '******', "
                                          + "userpswd = '{1}', "
                                          + "userid  = '{2}', "
                                          + "usertype  = {3} "
                                          + "where username = '******'",
                                          user.Username,
                                          user.Password,
                                          user.Userid,
                                          user.Type,
                                          user.Username
                                          );

            return(help.updateDate(cmd) > 0);
        }
Ejemplo n.º 21
0
 /// <summary>
 /// 添加省公司下面各个市级公司单独的文档
 /// </summary>
 public void AddCityPart()
 {
     try
     {
         IList <Companymodel> lstCM = DBhelper.GetChildcompany(CompanyID);
         var tasks = new Task[lstCM.Count];
         for (int i = 0; i < lstCM.Count; ++i)
         {
             LogHelper.WriteLog(typeof(CreateProvinceCompany), "AddCityPart:" + lstCM[i].ID.ToString());
             tasks[i] = Task.Run(() => (new CREATE(docCompilationListener)).compilationdocument((int)lstCM[i].ID));
         }
         Task.WaitAll(tasks);
     }
     catch (System.Exception ex)
     {
         LogHelper.WriteLog(typeof(CreateProvinceCompany), ex);
     }
 }
Ejemplo n.º 22
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string id = this.dataGridView1.SelectedRows[0].Cells["OutID"].Value.ToString();

            string sql = "delete from OutStock where OutID=" + id;
            bool   r   = DBhelper.BuCha(sql);

            if (r)
            {
                MessageBox.Show("删除成功!");
                string Sql2 = "select OutID,OutNum,OutDate,OutAddress,OutBrand,OutPrice from OutStock;";
                this.dataGridView1.DataSource = DBhelper.Cha(Sql2).Tables[0];
            }
            else
            {
                MessageBox.Show("删除失败!");
            }
        }
Ejemplo n.º 23
0
        public List <userModel> sel()
        {
            string           sql    = "select * from login";
            SqlDataReader    reader = DBhelper.ExcuteSqlDataReader(sql);
            List <userModel> list   = new List <userModel>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    userModel usermodel = new userModel();
                    usermodel.name = reader["name"].ToString();
                    usermodel.pwd  = reader["pwd"].ToString();
                    list.Add(usermodel);
                }
            }
            return(list);
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 从数据库中获取建成投运10年内的房屋面积、建成投运10-20年内的房屋面积和建成投运30年以上的房屋面积并存入FDXXsentence3对象中。
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static countryFDXXsentence3 GetInfo(int id)
        {
            countryFDXXsentence3 fs = new countryFDXXsentence3();
            string        temp      = "";
            IDbConnection mycon     = DBhelper.OpenConnection();

            try
            {
                string     sql   = CompilationDocumentSQL.GetcountryFDXXsentence3SQL(id);
                IDbCommand mycom = DBFactory.getSingleton().getCommand(sql, mycon);
                using (IDataReader myReader = mycom.ExecuteReader()) //执行command并得到相应的DataReader
                {
                    while (myReader.Read())                          //把得到的值赋给fm对象
                    {
                        temp = (string)myReader["TJXM"];
                        if (temp == "10年以内(含10年)")
                        {
                            fs.FWMJ_10 = (decimal)myReader["FCMJ"];
                        }
                        else if (temp == "10-20年(含20年)")
                        {
                            fs.FWMJ_1020 = (decimal)myReader["FCMJ"];
                        }
                        else if (temp == "20-30年(含30年)")
                        {
                            fs.FWMJ_2030 = (decimal)myReader["FCMJ"];
                        }
                        else
                        {
                            fs.FWMJ_30 = (decimal)myReader["FCMJ"];
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(typeof(countryFDXXsentence3), ex);
            }
            finally
            {
                mycon.Close();
            }
            return(fs);
        }
Ejemplo n.º 25
0
 /// <summary>
 /// 添加市公司本部和县级公司模块(作为省公司下级的市公司)
 /// </summary>
 /// <param name="document"></param>
 /// <param name="childcountryID"></param>
 public void Addcountrycompanies(DocX document, int childcountryID, NumoftitleHelper title)
 {
     try
     {
         List <Companymodel> CChildcompany = DBhelper.GetChildcompany(childcountryID);
         foreach (Companymodel ccm in CChildcompany)//让市公司本部优先生成
         {
             if (ccm.property == "本部")
             {
                 title.Less1Zero();
                 var h1 = document.InsertParagraph(title.num1title() + ccm.name);
                 h1.StyleName = "Heading1";
                 using (FontFamily fontfamily = new FontFamily("宋体"))
                 {
                     h1.Color(Color.Black).FontSize(22).Font(fontfamily);
                 }
                 h1.InsertPageBreakBeforeSelf();
                 CreateCountryCompany ccc = new CreateCountryCompany();
                 ccc.createword(document, ccm, title);
                 break;
             }
         }
         foreach (Companymodel ccm in CChildcompany)
         {
             if (ccm.property != "本部")
             {
                 title.Less1Zero();
                 var h1 = document.InsertParagraph(title.num1title() + ccm.name);
                 h1.StyleName = "Heading1";
                 using (FontFamily fontfamily = new FontFamily("宋体"))
                 {
                     h1.Color(Color.Black).FontSize(22).Font(fontfamily);
                 }
                 h1.InsertPageBreakBeforeSelf();
                 CreateCountryCompany ccc = new CreateCountryCompany();
                 ccc.createword(document, ccm, title);
             }
         }
     }
     catch (System.Exception ex)
     {
         LogHelper.WriteLog(typeof(CreateCityCompany), ex);
     }
 }
Ejemplo n.º 26
0
        public userModel selname(string model)
        {
            string sql = "select * from login where name=@name";

            SqlParameter[] parames = new SqlParameter[1];
            parames[0] = new SqlParameter("@name", model);
            SqlDataReader reader    = DBhelper.ExcuteSqlDataReader(sql, parames);
            userModel     usermodel = new userModel();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    usermodel.name = reader["name"].ToString();
                    usermodel.pwd  = reader["pwd"].ToString();
                }
            }
            return(usermodel);
        }
Ejemplo n.º 27
0
        public string GetInitials()
        {
            var Initial = DBhelper.GetQuery("tblagent", "agentcode", "agentname", txinitial.Text);

            cmd = DBhelper.GetRelation(Initial);
            string uId = null;

            if (cmd != null)
            {
                dt  = new DataTable();
                sda = new MySqlDataAdapter(cmd);
                sda.Fill(dt);
                foreach (DataRow dr in dt.Rows)
                {
                    uId = dr["agentcode"].ToString();
                }
            }
            return(uId);
        }
Ejemplo n.º 28
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult re = MessageBox.Show("确定要删除吗?", "温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (re == DialogResult.Yes)
            {
                string id  = this.dataGridView1.SelectedRows[0].Cells["StaffId"].Value.ToString();
                string sql = "delete from Staff where StaffId=" + id;
                bool   r   = DBhelper.BuCha(sql);
                if (r)
                {
                    MessageBox.Show("删除成功!");
                }
                else
                {
                    MessageBox.Show("删除失败!");
                }
            }
        }
Ejemplo n.º 29
0
        public static User get_user_by_username(string username)
        {
            DBhelper help = new DBhelper();
            string   cmd  = string.Format("select username, userpswd, userid, usertype from sys_user "
                                          + "where username = '******' ", username);
            DataTable dt = help.SqlSelect(cmd, "sys_user");

            if (dt == null || dt.Rows.Count == 0)
            {
                return(null);
            }
            User user = new User();

            user.Username = dt.Rows[0]["username"].ToString();
            user.Password = dt.Rows[0]["userpswd"].ToString();
            user.Userid   = dt.Rows[0]["userid"].ToString();
            user.Type     = dt.Rows[0]["usertype"].ToString();
            return(user);
        }
Ejemplo n.º 30
0
        public string GetSubjectId()
        {
            var SubId = DBhelper.GetQuery("subjectform", "id", "subject", subject.Text);

            cmd = DBhelper.GetRelation(SubId);
            string sId = null;

            if (cmd != null)
            {
                dt  = new DataTable();
                sda = new MySqlDataAdapter(cmd);
                sda.Fill(dt);
                foreach (DataRow dr in dt.Rows)
                {
                    sId = dr["id"].ToString();
                }
            }
            return(sId);
        }
Ejemplo n.º 31
0
        public IActionResult SubmitPost(string message)
        {
            string json = HttpContext.Session.GetString("User");

            Object objectuser = JsonConvert.DeserializeObject(json);

            ViewBag.user = objectuser;
            var user = ViewBag.user;

            string   Firstname = user.Firstname;
            string   Surname   = user.Surname;
            string   Username  = user.Username;
            string   Body      = message;
            DateTime Date      = DateTime.Now;

            DBhelper.CreatePost(Firstname, Surname, Username, Body, Date, "Posts");

            return(RedirectToAction("Index", "Feed"));
        }