コード例 #1
0
ファイル: ShuaDanPDDFrom.cs プロジェクト: ourstoryzj/mumu
        private void btn_piliangsave_Click(object sender, EventArgs e)
        {
            string        fenge = txt_fenge.Text.Trim();
            List <string> list  = txt_piliang.Text.ToListByLine();

            foreach (string str in list)
            {
                try
                {
                    string[] temp    = str.ToSplit(fenge);
                    string   phone   = temp[0];
                    string   account = temp[1];
                    string   pwd     = temp[2];

                    shuadan_account sa = new shuadan_account();
                    sa.sdaccount = account;
                    sa.sdadate   = DateTime.Now;
                    sa.sdaphone  = phone;
                    sa.sdapwd    = pwd;
                    sa.sdastate  = "1";

                    BLL.shuadan_accountManager.Insert(sa);
                }
                catch (Exception ex)
                {
                    ex.ToShow();
                }
            }

            ("保存成功,共" + list.Count.ToString() + "条信息").ToShow();
            bind();
            txt_piliang.Text = "";
        }
コード例 #2
0
ファイル: ShuaDanPDDFrom.cs プロジェクト: ourstoryzj/mumu
        private void dgv_type_CellParsing(object sender, DataGridViewCellParsingEventArgs e)
        {
            try
            {
                string colname = dgv_type.Columns[dgv_type.CurrentCell.ColumnIndex].Name;
                if (colname.Equals("col_account") || colname.Equals("col_pwd") || colname.Equals("col_phone") || colname.Equals("col_remark"))
                {
                    shuadan_account hs = (shuadan_account)dgv_type.CurrentRow.DataBoundItem;
                    if (hs != null)
                    {
                        string col_account = dgv_type["col_account", e.RowIndex].EditedFormattedValue == null ? "" : dgv_type["col_account", e.RowIndex].EditedFormattedValue.ToString();
                        string col_pwd     = dgv_type["col_pwd", e.RowIndex].EditedFormattedValue == null ? "" : dgv_type["col_pwd", e.RowIndex].EditedFormattedValue.ToString();
                        string col_phone   = dgv_type["col_phone", e.RowIndex].EditedFormattedValue == null ? "" : dgv_type["col_phone", e.RowIndex].EditedFormattedValue.ToString();
                        string col_remark  = dgv_type["col_remark", e.RowIndex].EditedFormattedValue == null ? "" : dgv_type["col_remark", e.RowIndex].EditedFormattedValue.ToString();

                        hs.sdaccount = col_account;
                        hs.sdapwd    = col_pwd;
                        hs.sdaphone  = col_phone;
                        hs.sdaremark = col_remark;

                        BLL.shuadan_accountManager.Update(hs);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToLog();
            }
        }
コード例 #3
0
    protected void btn_save2_Click(object sender, EventArgs e)
    {
        try
        {
            string   data     = txt_data.Text.Trim();
            string[] ss       = data.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
            int      count_ok = 0;
            int      count_no = 0;
            foreach (string s in ss)
            {
                //if (s.IndexOf("成功") != -1)
                //{
                string[]        arry = s.Replace("----", "-").Split(new char[] { '-' });
                int             i    = 1;
                shuadan_account sa   = new shuadan_account();
                sa.sdadate        = DateTime.Now;
                sa.sdastate_phone = "0";
                sa.sdastate       = "0";

                foreach (string temp in arry)
                {
                    if (i == 1)
                    {
                        sa.sdaccount = temp;
                    }
                    else if (i == 2)
                    {
                        sa.sdapwd = temp;
                    }
                    i++;
                }
                if ((BLL.shuadan_accountManager.SearchNum(sa.sdaccount, "", "", new DateTime(), new DateTime())) < 1)
                {
                    if (BLL.shuadan_accountManager.Insert(sa) == 1)
                    {
                        count_ok++;
                    }
                    else
                    {
                        count_no++;
                    }
                }
                else
                {
                    count_no++;
                }
                //}
            }
            Manager.Alert("批处理操作完成:\\n成功添加 " + count_ok.ToString() + " 条信息" + (count_no == 0 ? "" : "\\n添加失败" + count_no.ToString() + "条信息!请注意核实!"), Page);
        }
        catch (Exception ex)
        {
            Manager.Alert(ex.ToString(), Page);
        }
        Manager.page_href_reload(Page);
    }
コード例 #4
0
        /// <summary>
        /// 从一个MySqlDataReader里读数据
        /// </summary>
        /// <param name="Reader">MySqlDataReader</param>
        /// <returns>shuadan_accountExample</returns>
        public static shuadan_account GetByReader(MySqlDataReader Reader)
        {
            shuadan_account shuadan_accountExample = new shuadan_account();

            shuadan_accountExample.sdaccount = Reader["sdaccount"] == DBNull.Value ? null : Reader["sdaccount"].ToString();
            shuadan_accountExample.sdadate   = Reader["sdadate"] == DBNull.Value ? new DateTime() : Convert.ToDateTime(Reader["sdadate"]);
            shuadan_accountExample.sdaid     = Reader["sdaid"] == DBNull.Value ? 0 : (int)Reader["sdaid"];
            shuadan_accountExample.sdapwd    = Reader["sdapwd"] == DBNull.Value ? null : Reader["sdapwd"].ToString();
            shuadan_accountExample.sdastate  = Reader["sdastate"] == DBNull.Value ? null : Reader["sdastate"].ToString();
            return(shuadan_accountExample);
        }
コード例 #5
0
    protected void btn_save_Click(object sender, EventArgs e)
    {
        try
        {
            string name        = txt_name.Text.Trim();
            string state       = ddl_state.SelectedValue.ToString();
            string state_phone = ddl_state_phone.SelectedValue.ToString();
            string pwd         = txt_pwd.Text.Trim();

            shuadan_account sa = new shuadan_account();
            if (!string.IsNullOrEmpty(id))
            {
                sa = BLL.shuadan_accountManager.SearchBysdaid(Convert.ToInt32(id));
            }
            else
            {
                sa.sdadate = DateTime.Now;
            }

            sa.sdaccount      = name;
            sa.sdapwd         = pwd;
            sa.sdastate       = state;
            sa.sdastate_phone = state_phone;


            int res = 0;
            if (string.IsNullOrEmpty(id))
            {
                if ((BLL.shuadan_accountManager.SearchNum(sa.sdaccount, "", "", new DateTime(), new DateTime())) < 1)
                {
                    res = BLL.shuadan_accountManager.Insert(sa);
                }
            }
            else
            {
                res = BLL.shuadan_accountManager.Update(sa);
            }
            if (res == 1)
            {
                Manager.Alert("保存成功", Page);
            }
            else
            {
                Manager.Alert("保存失败", Page);
            }
        }
        catch (Exception ex)
        {
            Manager.Alert(ex.ToString(), Page);
        }
        Manager.page_href_reload(Page);
    }
コード例 #6
0
        /// <summary>
        /// 查询全部数据
        /// </summary>
        /// <returns>IList</returns>
        /*查看是否为视图*/
        public IList <shuadan_account> SearchAll()
        {
            DBHelper.sqlstr = "select * from shuadan_account ";
            List <shuadan_account> list   = new List <shuadan_account>();
            MySqlDataReader        reader = DBHelper.ExecuteReader();

            while (reader.Read())
            {
                shuadan_account Obj = GetByReader(reader);
                list.Add(Obj);
            }
            reader.Close();
            return(list);
        }
コード例 #7
0
        /// <summary>
        /// 根据表,获取一个MySqlParameter数组
        /// </summary>
        /// <returns>MySqlParameter[]</returns>
        public static MySqlParameter[] GetSqlParameter(shuadan_account shuadan_accountExample)
        {
            List <MySqlParameter> list_param = new List <MySqlParameter>();

            if (!string.IsNullOrEmpty(shuadan_accountExample.sdaccount))
            {
                list_param.Add(new MySqlParameter("@sdaccount", shuadan_accountExample.sdaccount));
            }
            else
            {
                list_param.Add(new MySqlParameter("@sdaccount", DBNull.Value));
            }
            if (shuadan_accountExample.sdadate != new DateTime() && shuadan_accountExample.sdadate != null)
            {
                list_param.Add(new MySqlParameter("@sdadate", shuadan_accountExample.sdadate.ToString("yyyy-MM-dd")));
            }
            else
            {
                list_param.Add(new MySqlParameter("@sdadate", DBNull.Value));
            }

            if (!string.IsNullOrEmpty(shuadan_accountExample.sdapwd))
            {
                list_param.Add(new MySqlParameter("@sdapwd", shuadan_accountExample.sdapwd));
            }
            else
            {
                list_param.Add(new MySqlParameter("@sdapwd", DBNull.Value));
            }

            if (!string.IsNullOrEmpty(shuadan_accountExample.sdastate))
            {
                list_param.Add(new MySqlParameter("@sdastate", shuadan_accountExample.sdastate));
            }
            else
            {
                list_param.Add(new MySqlParameter("@sdastate", DBNull.Value));
            }
            MySqlParameter[] param = new MySqlParameter[list_param.Count];
            int index = 0;

            foreach (MySqlParameter p in list_param)
            {
                param[index] = p;
                index++;
            }
            return(param);
        }
コード例 #8
0
        /// <summary>
        /// 根据sdaid,查询一条数据
        /// </summary>
        /// <param name="sdaid"></param>
        /// <returns></returns>
        public shuadan_account SearchBysdaid(int sdaid)
        {
            DBHelper.sqlstr = "select * from shuadan_account where sdaid = @sdaid";
            MySqlParameter[] param = new MySqlParameter[] {
                new MySqlParameter("@sdaid", sdaid)
            };
            MySqlDataReader reader = DBHelper.ExecuteReader(param);
            shuadan_account Obj    = null;

            if (reader.Read())
            {
                Obj = GetByReader(reader);
            }
            reader.Close();
            return(Obj);
        }
コード例 #9
0
ファイル: ShuaDanPDDFrom.cs プロジェクト: ourstoryzj/mumu
        private void dgv_type_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                //DataGridView dgv_type = (DataGridView)sender;
                Common.DataGridViewHelper dgv_type = (Common.DataGridViewHelper)sender;
                //如果不是首行
                if (e.RowIndex > -1)
                {
                    string          colname = dgv_type.Columns[e.ColumnIndex].Name;
                    shuadan_account sa      = (shuadan_account)dgv_type.CurrentRow.DataBoundItem;
                    if (colname == "col_state")
                    {
                        #region 修改状态
                        sa.sdastate = sa.sdastate == "1" ? "2" : "1";
                        BLL.shuadan_accountManager.Update(sa);
                        dgv_type.ToClearChecked();
                        #endregion
                    }
                    else if (colname == "col_del")
                    {
                        #region 修改状态
                        if (MessageBox.Show("确定要删除吗?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                        {
                            BLL.shuadan_accountManager.Delete(sa.sdaid);
                            dgv_type.ToAfterDelete(e.RowIndex);
                        }
                        #endregion
                    }
                    else if (colname == "col_login")
                    {
                        #region 登录账号
                        tabControl1.SelectedTab = tp_shuadan;
                        login(sa.sdaccount, sa.sdapwd);

                        btn_shuadan_geren.PerformClick();
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #10
0
ファイル: ShuaDanPDDFrom.cs プロジェクト: ourstoryzj/mumu
        private void btn_delete_Click_1(object sender, EventArgs e)
        {
            List <int> list = dgv_type.GetDeleteCheckedIndex();

            if (list.Count > 0)
            {
                foreach (int i in list)
                {
                    shuadan_account hs = (shuadan_account)dgv_type.Rows[i].DataBoundItem;
                    BLL.shuadan_accountManager.Delete(hs.sdaid);
                    dgv_type.ToAfterDelete(i);
                }
                "删除成功".ToShow();
            }
            else
            {
                "请选择需要删除的信息".ToShow();
            }
        }
コード例 #11
0
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txt_account = GridView1.Rows[e.RowIndex].FindControl("txt_account") as TextBox;
        TextBox txt_pwd     = GridView1.Rows[e.RowIndex].FindControl("txt_pwd") as TextBox;

        int             id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values["sdaid"]);
        shuadan_account sa = BLL.shuadan_accountManager.SearchBysdaid(id);

        sa.sdaccount = txt_account.Text.Trim();
        sa.sdapwd    = txt_pwd.Text.Trim();
        if (BLL.shuadan_accountManager.Update(sa) != 1)
        {
            AJAXManager.Alert(this.UpdatePanel1, "修改失败");
        }
        else
        {
            GridView1.EditIndex = -1;
            bind();
        }
    }
コード例 #12
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        string state = e.CommandName;

        if (state == "state")
        {
            int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["sdaid"].ToString());
            if (id != 0)
            {
                shuadan_account sa = BLL.shuadan_accountManager.SearchBysdaid(id);
                sa.sdastate = sa.sdastate == "1" ? "0" : "1";
                if (BLL.shuadan_accountManager.Update(sa) != 1)
                {
                    AJAXManager.Alert(this.UpdatePanel1, "修改失败");
                }
                else
                {
                    GridView1.EditIndex = -1;
                    bind();
                }
            }
        }
        else if (state == "state_phone")
        {
            int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["sdaid"].ToString());
            if (id != 0)
            {
                shuadan_account sa = BLL.shuadan_accountManager.SearchBysdaid(id);
                sa.sdastate_phone = sa.sdastate_phone == "1" ? "0" : "1";
                if (BLL.shuadan_accountManager.Update(sa) != 1)
                {
                    AJAXManager.Alert(this.UpdatePanel1, "修改失败");
                }
                else
                {
                    GridView1.EditIndex = -1;
                    bind();
                }
            }
        }
    }
コード例 #13
0
ファイル: ShuaDanPDDFrom.cs プロジェクト: ourstoryzj/mumu
        //void showurl()
        //{
        //    ThreadFunDelegate tfd = new ThreadFunDelegate(ThreadFun);
        //    tfd.Invoke();
        //}

        //delegate void ThreadFunDelegate();
        //void ThreadFun()
        //{
        //    txt_goodsurl.Text = webBrowser1.Address;
        //}


        #endregion

        /*2020年4月14日 17:33:05新加*/

        #region 添加话术类型

        private void btn_typesave_Click(object sender, EventArgs e)
        {
            string account = txt_account.Text.Trim();
            string remark  = txt_remark.Text.Trim();
            string state   = cb_state2.Text == "启用" ? "1" : "2";
            string pwd     = txt_pwd.Text.Trim();
            string phone   = txt_phone.Text.Trim();

            shuadan_account sa = new shuadan_account();

            sa.sdaccount = account;
            sa.sdadate   = DateTime.Now;
            sa.sdaphone  = phone;
            sa.sdapwd    = pwd;
            sa.sdaremark = remark;
            sa.sdastate  = state;

            BLL.shuadan_accountManager.Insert(sa);

            bind();
        }
コード例 #14
0
 void bind()
 {
     if (!string.IsNullOrEmpty(id))
     {
         int temp = 0;
         if (int.TryParse(id, out temp))
         {
             shuadan_account sa = BLL.shuadan_accountManager.SearchBysdaid(temp);
             if (sa != null)
             {
                 try
                 {
                     txt_name.Text                 = sa.sdaccount;
                     txt_pwd.Text                  = sa.sdapwd;
                     ddl_state.SelectedValue       = sa.sdastate;
                     ddl_state_phone.SelectedValue = sa.sdastate_phone;
                     liter_date.Text               = sa.sdadate.ToString();
                 }
                 catch { }
             }
         }
     }
 }
コード例 #15
0
        /// <summary>
        /// 模糊搜索
        /// </summary>
        /// <param name="key">关键词</param>
        /// <param name="state">状态</param>
        /// <param name="id">int字段</param>
        /// <param name="startdate">起始时间</param>
        /// <param name="enddate">结束时间</param>
        /// <param name="orderby">排序</param>
        /// <returns>IList<shuadan_account></returns>
        public IList <shuadan_account> Search(int s, int e, string key, string state, int id, DateTime startdate, DateTime enddate, string orderby)
        {
            string sql1 = "select top " + (e - s + 1).ToString() + " * from shuadan_account where ";
            string sql2 = string.IsNullOrEmpty(key) ? " 1=1 " : " ( sdaccount like '%" + key + "%' or sdapwd like '%" + key + "%' or sdastate like '%" + key + "%' or sdaphone like '%" + key + "%' or sdaremark like '%" + key + "%' or sdaremark1 like '%" + key + "%'  )"; //删除无用字段,删除最后一个or
            string sql3 = string.IsNullOrEmpty(state) ? "" : " and sdastate= '" + state + "' ";                                                                                                                                                                               //状态字段,无用删除
            //string sql4 = id == 0 ? "" : " and id字段='" + id.ToString() + "' ";//Int字段,无用删除
            string sql5 = startdate == new DateTime() ? "" : " and DATEDIFF(D,'" + startdate.ToString("yyyy-MM-dd") + "',sdadate)>=0 ";                                                                                                                                       //时间字段,无用删除
            string sql6 = enddate == new DateTime() ? "" : " and DATEDIFF(D,'" + enddate.ToString("yyyy-MM-dd") + "',sdadate)<=0 ";                                                                                                                                           //时间字段,无用删除
            string sql7 = string.IsNullOrEmpty(orderby) ? " order by sdaid desc " : " order by " + orderby;
            string sql8 = s == 1 ? "" : " and sdaid not in ( select top " + (s - 1).ToString() + " sdaid from shuadan_account where " + sql2 + sql3 + sql5 + sql6 + sql7 + " ) ";

            DBHelper.sqlstr = sql1 + sql2 + sql3 + sql5 + sql6 + sql8 + sql7;
            List <shuadan_account> list   = new List <shuadan_account>();
            SqlDataReader          reader = DBHelper.ExecuteReader();

            while (reader.Read())
            {
                shuadan_account Obj = GetByReader(reader);
                list.Add(Obj);
            }
            reader.Close();
            return(list);
        }
コード例 #16
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public int Update(shuadan_account shuadan_accountExample)
 {
     DBHelper.sqlstr = "update shuadan_account set sdaccount=@sdaccount,sdadate='" + shuadan_accountExample.sdadate.ToString() + "',sdapwd=@sdapwd,sdastate=@sdastate where sdaid=" + shuadan_accountExample.sdaid;
     return(DBHelper.ExecuteNonQuery(GetSqlParameter(shuadan_accountExample)));
 }
コード例 #17
0
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public int Insert(shuadan_account shuadan_accountExample)
 {
     DBHelper.sqlstr = "insert into  shuadan_account (sdaccount,sdadate,sdapwd,sdastate)values(@sdaccount,'" + shuadan_accountExample.sdadate.ToString() + "',@sdapwd,@sdastate)";
     return(DBHelper.ExecuteNonQuery(GetSqlParameter(shuadan_accountExample)));
 }
コード例 #18
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public int Update(shuadan_account shuadan_accountExample)
 {
     DBHelper.sqlstr = "update shuadan_account set sdaccount=@sdaccount,sdapwd=@sdapwd,sdastate=@sdastate,sdadate=@sdadate,sdaphone=@sdaphone,sdaremark=@sdaremark,sdaremark1=@sdaremark1 where sdaid=" + shuadan_accountExample.sdaid;
     return(DBHelper.ExecuteNonQuery(GetSqlParameters(shuadan_accountExample)));
 }
コード例 #19
0
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public static int Insert(shuadan_account shuadan_accountExample)
 {
     return(Service.Insert(shuadan_accountExample));
 }
コード例 #20
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public static int Update(shuadan_account shuadan_accountExample)
 {
     return(Service.Update(shuadan_accountExample));
 }
コード例 #21
0
 /// <summary>
 /// 插入方法
 /// </summary>
 /// <param name="shuadan_account">shuadan_account表实例</param>
 /// <returns>int</returns>
 public int Insert(shuadan_account shuadan_accountExample)
 {
     DBHelper.sqlstr = "insert into  shuadan_account (sdaccount,sdapwd,sdastate,sdadate,sdaphone,sdaremark,sdaremark1)values(@sdaccount,@sdapwd,@sdastate,@sdadate,@sdaphone,@sdaremark,@sdaremark1)";
     return(DBHelper.ExecuteNonQuery(GetSqlParameters(shuadan_accountExample)));
 }