Exemplo n.º 1
0
        public RecordInfo getRecordsInfo(String difficulty, Context context)
        {
            dbHelper = new DBHelper(context);
            SQLiteDatabase db = dbHelper.WritableDatabase;
            SQLiteCursor gc = (SQLiteCursor)db.Query("general", null, "difficulty = ?", new String[]{difficulty}, null, null, null);
            int avgTimeColIndex = gc.GetColumnIndex("avgTime");
            int gamesCountColIndex = gc.GetColumnIndex("gamesCount");
            int avgTime = 0;
            int gamesCount = 0;
            if (gc.MoveToFirst()){
                avgTime = gc.GetInt(avgTimeColIndex);
                gamesCount = gc.GetInt(gamesCountColIndex);
            }
            RecordInfo result = new RecordInfo(avgTime, gamesCount, new Java.Lang.String(difficulty));
            SQLiteCursor c = (SQLiteCursor)db.Query("records", null, " difficulty = ?", new String[]{difficulty}, null, null, null);
            if (c.MoveToFirst()) {
                int timeColIndex = c.GetColumnIndex("time");

                result.addRecord(c.GetInt(timeColIndex));
                while (c.MoveToNext()) {
                    result.addRecord(c.GetInt(timeColIndex));
                }
            }
            return result;
        }
Exemplo n.º 2
0
 public void clearDB(Context context)
 {
     dbHelper = new DBHelper(context);
     SQLiteDatabase db = dbHelper.WritableDatabase;
     db.Delete("general", null, null);
     db.Delete("records", null, null);
 }
        public ListHitViewer()
        {
            InitializeComponent();
            db = new DBHelper();

            //load up the app bar
            ApplicationBar = new ApplicationBar();

            ApplicationBar.Mode = ApplicationBarMode.Minimized;
            ApplicationBar.Opacity = 1.0;
            ApplicationBar.IsVisible = true;
            ApplicationBar.IsMenuEnabled = true;

            //get the item from the phone state!  woo!
            if (PhoneApplicationService.Current.State.ContainsKey("CurrentItem") && PhoneApplicationService.Current.State["CurrentItem"] != null)
            {
                _item = PhoneApplicationService.Current.State["CurrentItem"] as OldItem;

                //only show share if the _item is not null
                ApplicationBarIconButton btnShareAppBar = new ApplicationBarIconButton();
                btnShareAppBar.IconUri = new Uri("/Assets/AppBarIcons/share.png", UriKind.Relative);
                btnShareAppBar.Text = "Tap To Share";
                ApplicationBar.Buttons.Add(btnShareAppBar);
                btnShareAppBar.Click += new EventHandler(btnShareAppBar_Click);
            }

            //feedback button
            ApplicationBarIconButton btnFeedbackAppBar = new ApplicationBarIconButton();
            btnFeedbackAppBar.IconUri = new Uri("/Assets/AppBarIcons/questionmark.png", UriKind.Relative);
            btnFeedbackAppBar.Text = "Feedback";
            ApplicationBar.Buttons.Add(btnFeedbackAppBar);
            btnFeedbackAppBar.Click += new EventHandler(btnFeedbackAppBar_Click);
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 标签信息
            string strTagInfo = "";

            try
            {
                string sql = "select * from [tb_tag] where tag_ispublic=1";
                DataTable dt = new DataTable();
                DBHelper dbh = new DBHelper(config.DBConn);
                dt = dbh.ExecuteDataTable("", sql);

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        strTagInfo += "<a href=\"default.aspx?id=" + dt.Rows[i]["tag_id"].ToString() + "\" class=\"tag\" target=\"_blank\">" + dt.Rows[i]["tag_name"].ToString() + "</a>";
                    }
                }

                dbh.Dispose();
                dt.Dispose();
            }
            catch (Exception ex)
            {
                strTagInfo = ex.ToString();
            }

            this.tagBall.InnerHtml = strTagInfo;

            #endregion
        }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrWhiteSpace(Request.QueryString["Exhibition"])) return;

            string strExhibitionId = Request.QueryString["Exhibition"];

            DBHelper objHelper = new DBHelper();
            General objGen = new General();

            string strSQL = @"SELECT EXHIBITION_NAME,
                                     EXHIBITION_DETAILS,
                                     EXHIBITON_TEXT,
                                     EXHIBITION_IMAGE
                              FROM   INSTA_MST_EXHIBITION
                              WHERE  EXHIBITION_ID =" + objGen.gReplaceQuotes(strExhibitionId);
            IDataReader reader = objHelper.gExecuteReader(CommandType.Text, strSQL);
            while (reader.Read())
            {

                img.Src = "../../upload/images/Exhibition/" + Convert.ToString(reader["EXHIBITION_IMAGE"]);
                ltHeading.Text = Convert.ToString(reader["EXHIBITION_NAME"]) + Convert.ToString(reader["EXHIBITION_DETAILS"]);
                ltDetail.Text = Convert.ToString(reader["EXHIBITON_TEXT"]);
            }
            reader.Close();
            reader.Dispose();

        }
    }
Exemplo n.º 6
0
        DBHelper helper;  // 和数据库打交道

        public AddBudget(string name)
        {
            InitializeComponent();
            currentUser = name;
            helper = new DBHelper();
            initialize();
        }
Exemplo n.º 7
0
        public void QueryTest()
        {
            // Arrange-测试设置,创建对象
            DBHelper db = new DBHelper();
            Customer customer = new Customer()
                                               {
                                                   UserName = "******",
                                                   Password = "******",
                                                   Email = "EMAIL-1 ",
                                                   PhoneNumber = "PHONE-1 ",
                                                   IsFirstTimeLogin = false,
                                                   AccessFailedCount = 0,
                                                   CreationDate = DateTime.Now,
                                                   IsActive = false
                                               };
            int count = 0;
            List<Customer> customerList = new List<Customer>();

            // 拼接字符串的时候要注意标量的名字要与类中的成员变量名一样(可忽略字母的大小写)
            // 例如:此处sql中的@Password中的Password就必须与Customer类中的成员变量Password名称一样(可忽略大小写)
            string querySQL = @"SELECT * FROM dbo.CICUser WHERE UserName=@UserName AND PasswordHash=@Password";

            // Act-测试行为,使用功能
            customerList = db.Query<Customer>(querySQL, customer).ToList();
            count = customerList.Count;

            // Assert-测试结果,验证结果
            Assert.AreEqual(1,count);
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Url.Host.ToLower() == "localhost")
            {
                //base.login_user_id = 40123; //user
                //base.login_user_id = 40110; //exec producer -- skip
                //base.login_user_id = 272; //producer -- elyse
                //base.login_user_id = 205; //coordinator
                base.login_user_id = 144; //administrator -- randy
                theader.Visible = false;
                aheader.Visible = false;
                levaNav.Visible = false;
                tfooter.Visible = false;
                levbNav.Visible = false;
                groupTest = this.TestGroupMembership;
            }
            else
            {
                base.Page_Load("/newallocations/LockAllocations.aspx");
                groupTest = base.testmembership;
            }
            DBHelper db = new DBHelper();
            if (!groupTest.Invoke(ref db, "A3Coordinator") && !groupTest.Invoke(ref db, "A2Administrator"))
                Response.Redirect("/permitError.html");

            int week_num = RGA.Allocations.Data.Utility.CurrectWeek() + 1;
            WeekNumber.Value = week_num.ToString();
            Week.Text = RGA.Allocations.Data.Utility.CurrectWeekStartDate(week_num).ToString("MM/dd/yy");
        }
Exemplo n.º 9
0
        public List<string> GetUserID(string mode, string user_id)
        {
            List<string> lst = new List<string>();

            DBHelper helper = new DBHelper();
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter(CONSTANT.MODE, mode);
            param[1] = new SqlParameter(CONSTANT.USER_ID, user_id);
            DataSet ds = helper.executeSelectQuery(PROCEDURES.DELETE_USER_OPERTAION, param);
            if (ds != null)
            {

                foreach (DataRow item in ds.Tables[0].Rows)
                {


                    lst.Add(item[0].ToString());


                }
            }

            return lst;

        }
Exemplo n.º 10
0
        //const double AllowRange = 0.5;
        public static HoborModel HoborAsker(DBHelper DBHelper,  double XAxis, double YAxis)
        {
            HoborModel result=new HoborModel();
            double AllowRange = GetConfig.GetAllowRange();
            double xAxisAbove = XAxis + AllowRange
                , xAxisBelow = XAxis - AllowRange
                , yAxisAbove = YAxis + AllowRange
                , yAxisBelow = YAxis - AllowRange;

            string commandText = "SELECT * FROM Hobor WHERE XAxis BETWEEN @XAxis1 AND @XAxis2 AND YAxis Between @YXias1 AND @YXias2";
            System.Data.DataTable dt = DBHelper.GetData(commandText, new List<Parameter>()
            {
                new Parameter("@XAxis1",xAxisBelow)
                ,new Parameter("@XAxis2",xAxisAbove)
                ,new Parameter("@YXias1",yAxisBelow)
                ,new Parameter("@YXias2", yAxisAbove)
            });
            if (dt != null && dt.Rows.Count > 0)
            {
                result.IsExist = true;
                result.CountryName = dt.Rows[0]["CountryName"].ToString();
                result.Name = dt.Rows[0]["Name"].ToString();
                result.XAxis = Common.ConvertToDouble(dt.Rows[0]["XAxis"]);
                result.YAxis = Common.ConvertToDouble(dt.Rows[0]["YAxis"]);
                result.Info = dt.Rows[0]["Info"].ToString();
            }
            return result;
        }
Exemplo n.º 11
0
    internal DateTime[] GetYourDates(DBHelper db_, TZ tz_)
    {
      string tableName = "eventTimesGMT";

      switch (tz_)
      {
        case TZ.HK: tableName = "eventTimesHK"; break;
        case TZ.LN: tableName = "eventTimesLN"; break;
        case TZ.NY: tableName = "eventTimesNY"; break;
        case TZ.GMT: tableName = "eventTimesGMT"; break;

      }

      var sql = string.Format("select eventTimeLocal from {1} where eventID={0} order by eventTimeGMT", EventID, tableName);

      var ds = db_.Execute(sql);

      if (DBHelper.HasData(ds))
      {
        var list = new List<DateTime>();

        foreach (DataRow row in ds.Tables[0].Rows)
          list.Add((DateTime)row[0]);

        return list.ToArray();
      }

      return null;
    }
Exemplo n.º 12
0
        public ImportItem(IProject project, DBHelper dbHelper)
        {
            this._TheProject = project;
            this.DBHelper = dbHelper;

            this.TheProject.TargetDateChanged += this.OnDateChanged;
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IsInGroup groupTest = null;
            if (Request.Url.Host.ToLower() == "localhost")
            {
                //base.login_user_id = _UserId = 40123; //user
                //base.login_user_id = _UserId = 40110; //exec producer -- skip
                //base.login_user_id = _UserId = 272; //producer -- elyse
                //base.login_user_id = _UserId = 205; //coordinator
                base.login_user_id = _UserId = 144; //administrator -- randy

                theader.Visible = false;
                aheader.Visible = false;
                levaNav.Visible = false;
                tfooter.Visible = false;
                levbNav.Visible = false;
                groupTest = TestGroupMembership;
            }
            else
            {
                base.Page_Load("/newallocations/TeamAllocation.aspx");
                _UserId = base.login_user_id;
                groupTest = base.testmembership;
            }

            // determine if the user's group and set a variable to use when printing out allocations
            DBHelper db = new DBHelper();
            if (groupTest.Invoke(ref db, "A3Coordinator"))
                _secType = RgaWeb.SecurityType.EditAll;
            if (groupTest.Invoke(ref db, "A2Administrator"))
                _secType = RgaWeb.SecurityType.EditAll;
            if (groupTest.Invoke(ref db, "A8Producer"))
                _secType = RgaWeb.SecurityType.EditUpcoming;
            if (groupTest.Invoke(ref db, "A5ExecProducer"))
                _secType = RgaWeb.SecurityType.EditUpcoming;

            if (!Page.IsPostBack)
            {
                LoadRegions();
                LoadDepartments();

                // retrieve current week and date 
                _StartWeek = RgaData.Utility.CurrectWeek();
                _StartDate = RgaData.Utility.CurrectWeekStartDate(_StartWeek);

                // setup week picker
                ctlWeekPicker.CurrentWeek = _StartWeek;
                ctlWeekPicker.CurrectWeekStartDate = _StartDate;
            }
            else
            {
                // set start week
                _StartWeek = ctlWeekPicker.CurrentWeek;
            }

            // set up delegate to rebind the grid when week selection is changed
            DelSelectWeek delSelectWeek = new DelSelectWeek(this.ctlWeekPicker_SelectedIndexChanged);
            ctlWeekPicker.UpdateCurrentWeek = delSelectWeek;
        }
Exemplo n.º 14
0
 public bool Test()
 {
     SqlParameter[] param = new SqlParameter[1];
     DBHelper helper = new DBHelper();
     param[0] = new SqlParameter(CONSTANT.CAT_ID, "ZCVV");
     bool ds = helper.InsertQuery(PROCEDURES.CAT_INSERT, param);
     return ds;
 }
Exemplo n.º 15
0
        public void putRecord(long time, String difficulty, Context context)
        {
            dbHelper = new DBHelper(context);
            ContentValues cv = new ContentValues();
            SQLiteDatabase db = dbHelper.WritableDatabase;
            SQLiteCursor c = (SQLiteCursor)db.Query("records", null, " difficulty = ?", new String[]{difficulty}, null, null, null);
            int count = 1;
            if (c.MoveToFirst()) {

                int idColIndex = c.GetColumnIndex("id");
                int timeColIndex = c.GetColumnIndex("time");

                int maxDBindex = c.GetInt(idColIndex);
                int maxDBtime = c.GetInt(timeColIndex);
                count++;
                while (c.MoveToNext()) {
                    if (c.GetInt(timeColIndex) > maxDBtime){
                        maxDBtime = c.GetInt(timeColIndex);
                        maxDBindex = c.GetInt(idColIndex);
                    }
                    count++;
                }
                if (count == 6){
                    if (time < maxDBtime){
                        db.Delete("records", " id = ?", new String[]{maxDBindex + ""});
                    } else {
                        c.Close();
                        db.Close();
                        return;
                    }
                }
            }
            cv.Put("time", time);
            cv.Put("difficulty", difficulty);
            db.Insert("records", null, cv);
            cv.Clear();

            SQLiteCursor gc = (SQLiteCursor)db.Query("general", null, "difficulty = ?", new String[]{difficulty}, null, null, null);
            gc.MoveToFirst();
            int avgTimeColIndex = gc.GetColumnIndex("avgTime");
            int gamesCountColIndex = gc.GetColumnIndex("gamesCount");
            int avgTime = 0;
            int gamesCount = 0;
            if (gc.MoveToFirst()){
                avgTime = gc.GetInt(avgTimeColIndex);
                gamesCount = gc.GetInt(gamesCountColIndex);
            }
            int newGamesCount = gamesCount + 1;
            int newAvgTime = (avgTime * gamesCount / newGamesCount) + (int)(time / newGamesCount);
            cv.Put("difficulty", difficulty);
            cv.Put("avgTime", newAvgTime);
            cv.Put("gamesCount", newGamesCount);
            db.Delete("general", " difficulty = ?", new String[]{difficulty});
            db.Insert("general", null, cv);
            db.Close();
            c.Close();
            gc.Close();
        }
Exemplo n.º 16
0
 public frmCMS()
 {
     InitializeComponent();
     this.DBHelper = new DBHelper(new DBHelperConnection(this.ConnectionString ,this.FactoryName ));
     this.cmbApp.DataSource = this.DBHelper.GetDataSet("SELECT * FROM VOD_APP ORDER BY APP_CODE", "VOD_APP").Tables[0];
     this.cmbApp.DisplayMember = "APP_NAME";
     this.cmbApp.ValueMember = "APP_CODE";
     this.LoadList();
 }
Exemplo n.º 17
0
 /// <summary>
 /// ����Ĭ�ϵ����ݿ������
 /// </summary>
 /// <returns></returns>
 public static DBHelper Instance()
 {
     if (helper == null)
     {
         helper = new DBHelper(connectionString, dbProviderName);
         return helper;
     }
     return helper;
 }
Exemplo n.º 18
0
       public int deleteProduct(string product_id)
       {
           DBHelper helper = new DBHelper();

           SqlParameter[] param = new SqlParameter[1];
           param[0] = new SqlParameter(CONSTANT.PRODUCT_ID, product_id);
           int res = helper.InsertQuery(PROCEDURES.DELETE_PRODUCT, param);
           return res;
       }
Exemplo n.º 19
0
 public void QueryAllTest()
 {
     // arrange
     DBHelper db = new DBHelper();
     var list = db.QueryAll<DealerServiceLog>().ToList();
     // act
     int count = list.Count;
     // assert
     Assert.AreEqual(4, count);
 }
Exemplo n.º 20
0
        public ActionResult Create_Essay(Essay model,AccountLogin user)
        {
            DBHelper tmpDBHelper = new DBHelper();
            var title   = model.Title;
            var content = model.Content;
            var userID = Session["UserId"].ToString();

            tmpDBHelper.SqlExcute("insert into Essay(UserId,EssayTitle,EssayContent) values('"+userID+"','"+title+"','"+content+"')");

            return Redirect("../Home/Index");
        }
Exemplo n.º 21
0
       public int deleteSubCategory(int id)
       {
           DBHelper helper = new DBHelper();

           SqlParameter[] param = new SqlParameter[1];
           param[0] = new SqlParameter(CONSTANT.SUB_CATEGORY_ID, id);
           int res = helper.InsertQuery(PROCEDURES.DELETE_SUB_CATEGORY, param);

           return res;
        
       }
Exemplo n.º 22
0
        protected override void ResetStore()
        {
            var db = new DBHelper(DbProviderFactories.GetFactory("MySql.Data.MySqlClient"), ConnectionString);

            var store = (MySqlStore)Store;

            var a = store.EventsTable;
            var b = store.ProjectionIndexTable;
            var c = store.ProjectionCheckpointTable;

            db.ExecuteNonQuery($"TRUNCATE TABLE `{a}`; TRUNCATE TABLE `{b}`; TRUNCATE TABLE `{c}`;");
        }
Exemplo n.º 23
0
        protected override void ResetStore()
        {
            var db = new DBHelper(DbProviderFactories.GetFactory("System.Data.SQLite"), ConnectionString);

            var store = (SQLiteStore)Store;

            var a = store.EventsTable;
            var b = store.ProjectionIndexTable;
            var c = store.ProjectionCheckpointTable;

            db.ExecuteNonQuery($"DELETE FROM {a}; DELETE FROM SQLITE_SEQUENCE WHERE NAME='{a}'; DELETE FROM {b}; DELETE FROM SQLITE_SEQUENCE WHERE NAME='{b}'; DELETE FROM {c}; DELETE FROM SQLITE_SEQUENCE WHERE NAME='{c}';");
        }
Exemplo n.º 24
0
        protected override void ResetStore()
        {
            var db = new DBHelper(SqlClientFactory.Instance, ConnectionString);

            var store = (BaseSqlStore)Store;

            var a = store.EventsTable;
            var b = store.ProjectionIndexTable;
            var c = store.ProjectionCheckpointTable;

            db.ExecuteNonQuery($"TRUNCATE TABLE [{a}]; TRUNCATE TABLE [{b}]; TRUNCATE TABLE [{c}];");
        }
Exemplo n.º 25
0
    public static string GetEventDatesAsXml(EventGroup eg_, TZ tz_, DateTime minDate_, DateTime maxDate_)
    {
      DateTime[] dates = null;

      using (var db = new DBHelper())
      {
        dates = eg_.GetYourDates(db, tz_);
      }

      return dates == null ? null : dates
        .Where(x=>x >=minDate_ && x<=maxDate_)
        .Select(x => new { Date = x.ToString("dd-MMM-yyyy HH:mm:ss") }).ToGenericTableXml();
    }
Exemplo n.º 26
0
        // 初始化工作
        public void initialize()
        {
            common = new Entity.Commons(currentUser);
            helper = new DBHelper();

            inout.DisplayMemberPath = "Name";
            inout.SelectedValuePath = "Id";
            inout.ItemsSource = common.InOutList;

            acctype.DisplayMemberPath = "TypeName";
            acctype.SelectedValuePath = "Id";
            acctype.ItemsSource = common.AccountTypeList;
        }
Exemplo n.º 27
0
        public FinanceViewModel()
        {
            if (_db == null)
            {
                Assembly assem = Assembly.GetExecutingAssembly();
                _db = new DBHelper(assem.FullName.Substring(0, assem.FullName.IndexOf(",")), DBHelper.DatabaseName);
            } // if

            if (!isTestInserted)
            {
                _db.InsertTestValues();
                isTestInserted = true;
            } // if
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IsInGroup groupTest = null;

            if (Request.Url.Host.ToLower() == "localhost")
            {
                //base.login_user_id = _UserId = 40123; //user
                //base.login_user_id = _UserId = 40110; //exec producer -- skip
                //base.login_user_id = _UserId = 272; //producer -- elyse
                //base.login_user_id = _UserId = 205; //coordinator
                base.login_user_id = _UserId = 144; //administrator -- randy

                theader.Visible = false;
                aheader.Visible = false;
                levaNav.Visible = false;
                tfooter.Visible = false;
                levbNav.Visible = false;
                groupTest = TestGroupMembership;
            }
            else
            {
                base.Page_Load("/newallocations/DeptAllocation.aspx");
                _UserId = base.login_user_id;
                groupTest = base.testmembership;
            }

            // determine if the user's group and set a variable to use when printing out allocations
            DBHelper db = new DBHelper();
            if (groupTest.Invoke(ref db, "A3Coordinator"))
                _secType = RgaWeb.SecurityType.EditAll;
            if (groupTest.Invoke(ref db, "A2Administrator"))
                _secType = RgaWeb.SecurityType.EditAll;

            if (!Page.IsPostBack)
            {
                // retrieve current week and date 
                _WeekNumber = RgaData.Utility.CurrectWeek();
                _StartDate = RgaData.Utility.CurrectWeekStartDate(_WeekNumber);

                // setup week picker
                WeekPicker1.CurrentWeek = _WeekNumber;
                WeekPicker1.CurrectWeekStartDate = _StartDate;

                WeekNumber.Value = _WeekNumber.ToString();
            }
            WeekPicker1.WeekSpan = 1;
            WeekPicker1.ShowEndDate = false;
            DelSelectWeek delSelectWeek = new DelSelectWeek(this.WeekPicker1_SelectedIndexChanged);
            WeekPicker1.UpdateCurrentWeek = delSelectWeek;
        }
Exemplo n.º 29
0
        public void QueryManyTest()
        {
            // arrange
            DBHelper db = new DBHelper();
            string sql = "select CompanyName,CityId,CityName,Balance,Margin,PreDeposits,DealerClass,Partner_CompanyExtent.Score,OrderAmount,ContractAmount,Partner_CompanyExtent.[Status],SolutionIDs,DealerDistrict from Partner_Company,Partner_CompanyExtent where Partner_CompanyExtent.DealerID=Partner_Company.ID";

            sql = "SELECT * FROM DealerClassConfig  AS D JOIN DealerClassConfig AS D1 ON D.id = D1.ID ";
            var list = db.Query(sql).ToList();
            // act
            int count = list.Count;
            var first = (IDictionary<string, object>)list.FirstOrDefault();
            // assert
            Assert.AreEqual(3, count);
        }
Exemplo n.º 30
0
        public string getUserDetais()
        {
            DBHelper helper = new DBHelper();
            DataTable dt = helper.executeSelectQuery(PROCEDURES.GET_USER_DETAIS).Tables[0];

            if (dt != null)
            {
                return (JSONConvertor.getJSONData(dt));
            }
            else
            {
                return null;
            }

        }
Exemplo n.º 31
0
        public bool Insert(Answers a)
        {
            a.Id = DBHelper <Answers> .GetMaxId(tableName, "id");

            return(DBHelper <Answers> .Insert(tableName, DBHelper <Answers> .GetSim(a)) > 0);
        }
Exemplo n.º 32
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="DB">DBHelper的实例</param>
 public FOUNDERPCB_FRIGHTE_03BLL(DBHelper DB)
 {
     founderpcb_frighte_03Dal = new FOUNDERPCB_FRIGHTE_03DAL(DB);
 }
Exemplo n.º 33
0
 public AdminController()
     : base()
 {
     ViewBag.CurrentTab = "Administration";
     ViewBag.HideMail   = DBHelper.GetAbstractCourseHideMailValue(ActiveCourseUser.AbstractCourseID);
 }
Exemplo n.º 34
0
        protected void chk_CheckedChanged(object sender, EventArgs e)
        {
            RadioButton rdTrip = (RadioButton)sender;

            if (rdTrip.Checked)
            {
                pageName = Utils.GetParameter("page", "home");
                cid      = Utils.GetParameter("cid", string.Empty);
                cidsub   = Utils.GetParameter("cidsub", string.Empty);
                id       = Utils.GetParameter("id", string.Empty);

                //string cateName = Common.UtilityLocal.GetCateNameByLevel(pageName, cid, cidsub, id);
                string chkID = Utils.RemoveUnicode(rdTrip.Text).ToLower();
                string level = id != string.Empty ? "3" : Session["level"].ToString();
                Dictionary <string, object> dic = Common.UtilityLocal.GetProductCategory(pageName, cid, cidsub, string.Empty, LangInt, level);
                if (dic != null && dic.Count > 0)
                {
                    IList <PNK_ProductCategory> lst = dic["DictProductCategory"] as IList <PNK_ProductCategory>;
                    if (lst.Count > 0)
                    {
                        //lst là danh sách category đến cấp hiện tại, nhưng khi click chk cần lấy hết cấp con của cấp hiện tại
                        ProductCategoryBLL          pcBllCate = new ProductCategoryBLL();
                        IList <PNK_ProductCategory> lst1      = pcBllCate.GetList(LangInt, string.Empty, string.Empty, lst[0].Id, true, "p.ordering", 1, 1000, out total);
                        IList <PNK_ProductCategory> lst2      = lst1.Where(m => m.ProductCategoryDesc.NameUrl == chkID).ToList();

                        //Gen html image category
                        ltrHeaderCategory.Text = lst2.Count > 0 ? Common.UtilityLocal.ImagePathByFont(lst2[0]) : string.Empty;
                        categoryID             = lst2.Count > 0 ? lst2[0].Id.ToString() : string.Empty;

                        //Get product by categoryID when checked
                        if (categoryID != string.Empty)
                        {
                            DataTable dtb   = DBHelper.ExcuteFromCmd("SELECT * FROM dbo.fc_GetAllChildProductCategory(" + categoryID + ",1)", null);
                            string[]  array = dtb.AsEnumerable()
                                              .Select(row => row.Field <Int32>("id").ToString())
                                              .ToArray();
                            string idFirst = string.Join(",", array);

                            total = 0;
                            ProductBLL          pcBll      = new ProductBLL();
                            IList <PNK_Product> lstProduct = pcBll.GetList(LangInt, string.Empty, "1", idFirst, string.Empty, currentPageIndex, DBConvert.ParseInt(ConfigurationManager.AppSettings["pageSizeCate"]), out total);
                            this.records              = DBConvert.ParseString(total);
                            this.pager.PageSize       = DBConvert.ParseInt(ConfigurationManager.AppSettings["pageSizeCate"]);
                            this.pager.ItemCount      = total;
                            this.rptResult.DataSource = lstProduct;
                            this.rptResult.DataBind();

                            WebUtils.SeoPage(lst2[0].ProductCategoryDesc.MetaTitle, lst2[0].ProductCategoryDesc.MetaDecription, lst2[0].ProductCategoryDesc.MetaKeyword, this.Page);
                        }
                        else
                        {
                            this.records              = DBConvert.ParseString(total);
                            this.pager.PageSize       = DBConvert.ParseInt(ConfigurationManager.AppSettings["pageSizeCate"]);
                            this.pager.ItemCount      = total;
                            this.rptResult.DataSource = lst2;
                            this.rptResult.DataBind();
                        }
                    }
                }
            }
        }
Exemplo n.º 35
0
 public List <Answers> GetAnswerByQuestionId(int id, int pageSize, int pageNum, out int pageCount)
 {
     return(DBHelper <Answers> .Select(pageSize, pageNum, tableName, " questionId = " + id, "id", false, out pageCount, " id,anMemberId,answer,inTime,ip,isSys "));
 }