Ejemplo n.º 1
0
        protected void Rp_AdminList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            //ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "",
            //                                            "<script>alert('" + (e.Item.FindControl("r_credit") as Literal).Text + "');func();</script>", false);
            //var
            //    return;
            if (e.CommandName == "buy")
            {
                try
                {
                //string msg;
                    int Multiple = Convert.ToInt32((e.Item.FindControl("Literal1") as Literal).Text);
            //				int Multiple=-1;
                AutoBwsModel.Credit.package pkmodel=new AutoBwsModel.Credit.package ();
                pkmodel.id=0;
                pkmodel.create_date=DateTime.Now;
                pkmodel.level=Convert.ToInt32((e.Item.FindControl("DropDownList1") as DropDownList).SelectedItem.Text);
                pkmodel.levelForNextPeriod=Convert.ToInt32((e.Item.FindControl("DropDownList1") as DropDownList).SelectedItem.Text);
                pkmodel.name="";
                pkmodel.remark="";
                pkmodel.type_id=Convert.ToInt32(e.CommandArgument.ToString());
                pkmodel.user_id=CurrentUser.Id;
                string msg = "";
                 cm.AddOrUpdatePackage(pkmodel,CurrentUser,out msg);
                    //cm.BuyPackage(CurrentUser.Id, Convert.ToInt32(e.CommandArgument.ToString()), Multiple, out msg)
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "",
                                                        "<script>alert('" + msg + "');func();</script>", false);
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "",
                                                        "<script>alert('" + ex.Message + "');func();</script>", false);
                }

            }
        }
Ejemplo n.º 2
0
 public IList<AutoBwsModel.Credit.package> GetPackageUserAndCondition(int userid, string condition)
 {
     IList<AutoBwsModel.Credit.package> mList = new List<AutoBwsModel.Credit.package>();
     DataSet ds = this.GetList(" user_id =" + userid.ToString() + condition);
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         var model = new AutoBwsModel.Credit.package();
         setModel(r, ref model);
         mList.Add(model);
     }
     return mList;
 }
Ejemplo n.º 3
0
 //public void UpdateState(int  int id)
 //{
 //    DBHelper.ExecuteNonQuery(con, CommandType.Text, "Update package set state=" + state + " where id=" + id);
 //}
 public IList<AutoBwsModel.Credit.package> GetPackageByUserid(int id)
 {
     IList<AutoBwsModel.Credit.package> mList = new List<AutoBwsModel.Credit.package>();
     DataSet ds = GetList(" user_id =" + id);
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         var model = new AutoBwsModel.Credit.package();
         setModel_Michael(r, ref model);
         mList.Add(model);
     }
     return mList;
 }
Ejemplo n.º 4
0
 public IList<AutoBwsModel.Credit.package> GetPackageListByUserAndRole(string roleType, int user_id)
 {
     IList<AutoBwsModel.Credit.package> mList = new List<AutoBwsModel.Credit.package>();
     DataSet ds = new DataSet();
     switch (roleType)
     {
         case "S":
             ds = GetDetailWithUserAndPackageALL();
             break;
         case "A":
             ds = this.GetDetailWithUserAndPackage(user_id);
             break;
         case "SU":
             ds = GetDetailWithUserAndPackageForUser(user_id);
             break;
         case "P":
             ds = GetDetailWithUserAndPackageForUser(user_id);
             break;
     }
     //DataSet ds = this.GetList(" user_id =" + userid.ToString() + condition);
     foreach (DataRow r in ds.Tables[0].Rows)
     {
         var model = new AutoBwsModel.Credit.package();
         setModel(r, ref model);
         mList.Add(model);
     }
     return mList;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public AutoBwsModel.Credit.package GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("selec * from package ");
            strSql.Append(" where id=@id ");
            MySqlParameter[] parameters = {
                                          	new MySqlParameter("@id", MySqlDbType.Int32)
                                          };
            parameters[0].Value = id;

            AutoBwsModel.Credit.package model = new AutoBwsModel.Credit.package();
            DataSet ds = DBHelper.ExecuteDataset(con, CommandType.Text, strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                model.name = ds.Tables[0].Rows[0]["name"].ToString();
                model.remark = ds.Tables[0].Rows[0]["remark"].ToString();
                if (ds.Tables[0].Rows[0]["create_date"].ToString() != "")
                {
                    model.create_date = DateTime.Parse(ds.Tables[0].Rows[0]["create_date"].ToString());
                }
                //if (ds.Tables[0].Rows[0]["expired_date"].ToString() != "")
                //{
                //    model.expired_date = DateTime.Parse(ds.Tables[0].Rows[0]["expired_date"].ToString());
                //}
                //if (ds.Tables[0].Rows[0]["start_date"].ToString() != "")
                //{
                //    model.start_date = DateTime.Parse(ds.Tables[0].Rows[0]["start_date"].ToString());
                //}
                //if(ds.Tables[0].Rows[0]["credit_count"].ToString()!="")
                //{
                //    model.credit_count=int.Parse(ds.Tables[0].Rows[0]["credit_count"].ToString());
                //}
                if (ds.Tables[0].Rows[0]["user_id"].ToString() != "")
                {
                    model.user_id = int.Parse(ds.Tables[0].Rows[0]["user_id"].ToString());
                }
                //if (ds.Tables[0].Rows[0]["state"].ToString() != "")
                //{
                //    model.state = int.Parse(ds.Tables[0].Rows[0]["state"].ToString());
                //}
                if (ds.Tables[0].Rows[0]["type_id"].ToString() != "")
                {
                    model.type_id = int.Parse(ds.Tables[0].Rows[0]["type_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["level"].ToString() != "")
                {
                    model.type_id = int.Parse(ds.Tables[0].Rows[0]["level"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }