コード例 #1
0
ファイル: Card.cs プロジェクト: suizhikuo/KYCMS
 public M_Card GetCard(string account)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Account", SqlDbType.VarChar, 20) };
     commandParameters[0].Value = account;
     M_Card card = new M_Card();
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Card_GetCard", commandParameters);
     card.CardAccount = account;
     if (table.Rows.Count > 0)
     {
         if (table.Rows[0]["Type"].ToString() != "")
         {
             card.Type = (int.Parse(table.Rows[0]["Type"].ToString()) == 0) ? CardType.PointCard : CardType.MonthCard;
         }
         card.Password = table.Rows[0]["Password"].ToString();
         if (table.Rows[0]["IsUsed"].ToString() != "")
         {
             if ((table.Rows[0]["IsUsed"].ToString() == "1") || (table.Rows[0]["IsUsed"].ToString().ToLower() == "true"))
             {
                 card.IsUsed = true;
             }
             else
             {
                 card.IsUsed = false;
             }
         }
         if (table.Rows[0]["CardPoint"].ToString() != "")
         {
             card.CardPoint = int.Parse(table.Rows[0]["CardPoint"].ToString());
         }
         if (table.Rows[0]["CardDay"].ToString() != "")
         {
             card.CardDay = int.Parse(table.Rows[0]["CardDay"].ToString());
         }
         if (table.Rows[0]["AdminID"].ToString() != "")
         {
             card.AdminID = int.Parse(table.Rows[0]["AdminID"].ToString());
         }
         card.AdminName = table.Rows[0]["AdminName"].ToString();
         if (table.Rows[0]["UserID"].ToString() != "")
         {
             card.UserID = int.Parse(table.Rows[0]["UserID"].ToString());
         }
         card.UserName = table.Rows[0]["UserName"].ToString();
         if (table.Rows[0]["OverdueDate"].ToString() != "")
         {
             card.OverdueDate = DateTime.Parse(table.Rows[0]["OverdueDate"].ToString());
         }
         return card;
     }
     return null;
 }
コード例 #2
0
ファイル: Card.cs プロジェクト: suizhikuo/KYCMS
 public string Add(M_Card model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@CardAccount", SqlDbType.VarChar, 10), new SqlParameter("@Password", SqlDbType.VarChar, 200), new SqlParameter("@IsUsed", SqlDbType.Bit, 1), new SqlParameter("@CardPoint", SqlDbType.Int, 4), new SqlParameter("@CardDay", SqlDbType.Int, 4), new SqlParameter("@AdminID", SqlDbType.Int, 4), new SqlParameter("@AdminName", SqlDbType.VarChar, 50), new SqlParameter("@OverdueDate", SqlDbType.DateTime) };
     commandParameters[0].Value = (model.Type == CardType.MonthCard) ? 1 : 0;
     commandParameters[1].Value = model.CardAccount;
     commandParameters[2].Value = model.Password;
     commandParameters[3].Value = model.IsUsed;
     commandParameters[4].Value = model.CardPoint;
     commandParameters[5].Value = model.CardDay;
     commandParameters[6].Value = model.AdminID;
     commandParameters[7].Value = model.AdminName;
     commandParameters[8].Value = model.OverdueDate;
     DataTable table = SqlHelper.ExecuteTable(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Card_Add", commandParameters);
     string str = string.Empty;
     if (table.Rows.Count > 0)
     {
         str = table.Rows[0]["Account"].ToString();
     }
     return str;
 }
コード例 #3
0
ファイル: SetCard.aspx.cs プロジェクト: suizhikuo/KYCMS
    /// <summary>
    /// 批量生成
    /// </summary>
    protected void btnAddMore_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {

                M_Card model = new M_Card();

                model.AdminName = adminModel.AdminName;
                model.AdminID = adminModel.UserId;
                int cardType = int.Parse(ddlMoreType.SelectedValue);
                if (cardType == 0)//点卡
                {
                    model.Type = CardType.PointCard;
                    model.CardDay = 0;
                    try
                    {
                        model.CardPoint = int.Parse(txtMorePoint.Text);
                    }
                    catch
                    {
                        Function.ShowSysMsg(0, "<li>对不起,点数输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                    }
                }
                if (cardType == 1)//月卡
                {
                    model.Type = CardType.MonthCard;
                    try
                    {
                        model.CardDay = int.Parse(txtMoreDay.Text);
                    }
                    catch
                    {
                        Function.ShowSysMsg(0, "<li>对不起,天数输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                    }
                    model.CardPoint = 0;
                }
                model.IsUsed = false;
                try
                {
                    model.OverdueDate = DateTime.Parse(txtMoreOverdue.Text);
                }
                catch
                {
                    Function.ShowSysMsg(0, "<li>对不起,过期日期栏输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                }

                int num = 0;
                try
                {
                    num = int.Parse(txtMoreNum.Text);
                }
                catch
                {
                    Function.ShowSysMsg(0, "<li>对不起,张数输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                }
                string[] accounts = new string[num];
                string[] pwds = new string[num];

                for (int i = 0; i < num; i++)
                {
                    string pwd = GeneratPwd(txtMorePwd.Text);
                    model.Password = pwd;
                    model.CardAccount = GeneratPwd(txtMorePrifix.Text);
                    string ac = card.Add(model);
                    accounts[i] = ac;
                    pwds[i] = pwd;
                    System.Threading.Thread.Sleep(50);
                }
                DataTable dt = new DataTable();
                dt.Columns.Add("ID", typeof(int));
                dt.Columns.Add("卡号",typeof(string));
                dt.Columns.Add("密码",typeof(string));
                for (int i = 0; i < accounts.Length; i++)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = i + 1;
                    dr[1] = accounts[i];
                    dr[2] = pwds[i];
                    dt.Rows.Add(dr);
                }
                gvListMore.DataSource = dt;
                gvListMore.DataBind();
                lbMoreCount.Text = gvListMore.Rows.Count.ToString();
                mvAddCard.ActiveViewIndex = 4;
            }

        else
        {
            Response.Redirect("../Login.aspx");
        }
    }
コード例 #4
0
ファイル: SetCard.aspx.cs プロジェクト: suizhikuo/KYCMS
    /// <summary>
    /// 添加新卡
    /// </summary>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            if (adminModel != null)
            {
                M_Card model = new M_Card();
                model.AdminName = adminModel.AdminName;
                model.AdminID = adminModel.UserId;
                int cardType = int.Parse(ddlCardType.SelectedValue);
                if (cardType == 0)//点卡
                {
                    model.Type = CardType.PointCard;
                    model.CardDay = 0;
                    try
                    {
                        model.CardPoint = int.Parse(txtPoint.Text);
                    }
                    catch
                    {
                        Function.ShowSysMsg(0,"<li>对不起,点数输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                    }
                }
                if (cardType == 1)//月卡
                {
                    model.Type = CardType.MonthCard;
                    try
                    {
                        model.CardDay = int.Parse(txtDay.Text);
                    }
                    catch
                    {
                        Function.ShowSysMsg(0, "<li>对不起,天数输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                    }
                    model.CardPoint = 0;
                }
                model.CardAccount = GeneratPwd(txtCardPrifix.Text);
                model.IsUsed = false;
                try
                {
                    model.OverdueDate = DateTime.Parse(txtOverdueDate.Text).Date;
                }
                catch
                {
                    Function.ShowSysMsg(0, "<li>对不起,过期日期栏输入格式不正确。请重新输入</li><li><a href='javascript:window.history.back()'>返回上一步</a></li>");
                }

                model.Password = txtPassword.Text;

                string cardAccount = card.Add(model);

                lbAccount.Text = cardAccount;
                lbPwd.Text = txtPassword.Text;
                lbType.Text = ddlCardType.SelectedItem.Text;
                if (cardType == 1)
                {
                    B_Log.Add(LogType.Add, "新增月卡成功。卡号:"+cardAccount);
                }
                else if (cardType == 0)
                {
                    B_Log.Add(LogType.Add, "新增点卡成功。卡号:"+cardAccount);
                }
                mvAddCard.ActiveViewIndex = 1;
            }
        }
        else
        {
            Response.Redirect("../Login.aspx");
        }
    }
コード例 #5
0
ファイル: Card.cs プロジェクト: suizhikuo/KYCMS
 public void Update(M_Card model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Type", SqlDbType.Int, 4), new SqlParameter("@CardAccount", SqlDbType.VarChar, 20), new SqlParameter("@Password", SqlDbType.VarChar, 200), new SqlParameter("@IsUsed", SqlDbType.Bit, 1), new SqlParameter("@CardPoint", SqlDbType.Int, 4), new SqlParameter("@CardDay", SqlDbType.Int, 4), new SqlParameter("@AdminID", SqlDbType.Int, 4), new SqlParameter("@AdminName", SqlDbType.VarChar, 50), new SqlParameter("@UserID", SqlDbType.Int, 4), new SqlParameter("@UserName", SqlDbType.NVarChar), new SqlParameter("@OverdueDate", SqlDbType.DateTime) };
     commandParameters[0].Value = model.Type;
     commandParameters[1].Value = model.CardAccount;
     commandParameters[2].Value = model.Password;
     commandParameters[3].Value = model.IsUsed;
     commandParameters[4].Value = model.CardPoint;
     commandParameters[5].Value = model.CardDay;
     commandParameters[6].Value = model.AdminID;
     commandParameters[7].Value = model.AdminName;
     commandParameters[8].Value = model.UserID;
     commandParameters[9].Value = model.UserName;
     commandParameters[10].Value = model.OverdueDate;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_Card_Update", commandParameters);
 }
コード例 #6
0
ファイル: B_Card.cs プロジェクト: suizhikuo/KYCMS
 public void Update(M_Card model)
 {
     this.ic.Update(model);
     B_Log.Add(LogType.Update, "修改用户卡。卡号为" + model.CardAccount);
 }
コード例 #7
0
ファイル: B_Card.cs プロジェクト: suizhikuo/KYCMS
 public string Add(M_Card model)
 {
     return this.ic.Add(model);
 }