Exemplo n.º 1
0
        public void TestSortPlayers()
        {
            DataProcess _dataProcess = new DataProcess();
            var         result       = _dataProcess.SortPlayers(players);

            Assert.IsAssignableFrom <List <Players> >(result);
        }
Exemplo n.º 2
0
        private void OnInsert()
        {
            var dataSourceUpdate = this.Categorys.Where(c => c.CategoryID <= 0).ToList();
            DataProcess <Category> categoryDA = new DataProcess <Category>();

            categoryDA.Insert(dataSourceUpdate.ToArray());
        }
Exemplo n.º 3
0
    public static List <BSTerm> GetTerms(TermTypes termType, int iTermCount)
    {
        List <BSTerm> terms = new List <BSTerm>();

        using (DataProcess dp = new DataProcess())
        {
            string top = iTermCount == 0 ? String.Empty : "TOP " + iTermCount;

            if (termType != TermTypes.All)
            {
                dp.AddParameter("Type", termType.ToString().ToLowerInvariant());
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Terms WHERE [Type]=@Type ORDER BY [Name] ASC", top));
            }
            else
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Terms ORDER BY [Name] ASC", top));
            }

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSTerm bsTerm = new BSTerm();
                        FillTerm(dr, bsTerm);
                        terms.Add(bsTerm);
                    }
                }
            }
        }

        return(terms);
    }
Exemplo n.º 4
0
    public static List <BSTerm> GetTermsBySubID(TermTypes termType, int iSubID)
    {
        List <BSTerm> terms = new List <BSTerm>();

        using (DataProcess dp = new DataProcess())
        {
            if (termType != TermTypes.All)
            {
                dp.AddParameter("Type", termType.ToString().ToLowerInvariant());
                dp.AddParameter("SubID", iSubID);
                dp.ExecuteReader("SELECT * FROM Terms WHERE [Type]=@Type AND [SubID]=@SubID ORDER BY [Name] ASC");
            }
            else
            {
                dp.AddParameter("SubID", iSubID);
                dp.ExecuteReader("SELECT * FROM Terms WHERE [SubID]=@SubID ORDER BY [Name] ASC");
            }

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSTerm bsTerm = new BSTerm();
                        FillTerm(dr, bsTerm);
                        terms.Add(bsTerm);
                    }
                }
            }
        }

        return(terms);
    }
    public static List <BSWidget> GetWidgetsByColumnValue(string column, object value, int widgetCount, string orderBy)
    {
        List <BSWidget> widgets = new List <BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            string top = widgetCount > 0 ? "TOP " + widgetCount : String.Empty;

            if (!String.IsNullOrEmpty(column) && value != null)
            {
                dp.AddParameter(column, value);
                dp.ExecuteReader(String.Format("SELECT {0} * FROM [Widgets] WHERE [{1}]=@{1} {2}", top, column, orderBy));
            }
            else
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM [Widgets] {1}", top, orderBy));
            }
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();
                        FillWidget(dr, bsWidget);
                        widgets.Add(bsWidget);
                    }
                }
            }
        }
        return(widgets);
    }
    public static List <BSWidget> GetWidgetsByPlaceHolder(string placeHolder, bool visible)
    {
        List <BSWidget> widgets = new List <BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("PlaceHolder", placeHolder);
            dp.AddParameter("Visible", visible);
            dp.ExecuteReader("SELECT * FROM [Widgets] WHERE [PlaceHolder]=@PlaceHolder AND [Visible]=@Visible ORDER BY [Sort]");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();
                        FillWidget(dr, bsWidget);
                        widgets.Add(bsWidget);
                    }
                }
            }
        }

        return(widgets);
    }
    public static List <BSWidget> GetWidgetsBySorted()
    {
        List <BSWidget> widgets = new List <BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("Visible", true);
            dp.ExecuteReader("SELECT * FROM Widgets WHERE [Visible] = @Visible ORDER BY [Sort]");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();

                        FillWidget(dr, bsWidget);

                        widgets.Add(bsWidget);
                    }
                }
            }
        }

        return(widgets);
    }
Exemplo n.º 8
0
        public Plat(string server_addr = "broadcast.eicp.net:55881")

        {
            InitializeComponent();
            this.buttonLogin.Click   += ButtonLogin_Click;
            this.buttonOffline.Click += Offline_Click;
            ReadServerConfig();

            this.comboBoxServer.DataSource    = _dtServer;
            this.comboBoxServer.DisplayMember = "txt";
            this.comboBoxServer.ValueMember   = "val";

            if (File.Exists("./account.json"))
            {
                account = JsonConvert.DeserializeObject <Account>(File.ReadAllText("./account.json"));
            }
            //登录信息
            this.comboBoxServer.DataBindings.Add("Text", account, "ServerName", false, DataSourceUpdateMode.OnPropertyChanged);
            this.textBoxUser.DataBindings.Add("Text", account, "Investor", false, DataSourceUpdateMode.OnPropertyChanged);
            this.textBoxAppID.DataBindings.Add("Text", account, "AppID", false, DataSourceUpdateMode.OnPropertyChanged);
            this.textBoxAuthCode.DataBindings.Add("Text", account, "AuthCode", false, DataSourceUpdateMode.OnPropertyChanged);
            this.textBoxProductInfo.DataBindings.Add("Text", account, "ProductInfo", false, DataSourceUpdateMode.OnPropertyChanged);

            _dataProcess = new DataProcess(server_addr);
        }
Exemplo n.º 9
0
        private void loadData()
        {
            DataProcess <Category> categoryDA = new DataProcess <Category>();
            var dataSource = new ObservableCollection <Category>(categoryDA.Select());

            this.Categorys = dataSource;
        }
Exemplo n.º 10
0
        private async void Refresh_Click(object sender, RoutedEventArgs e)
        {
            contentRing.IsActive = true;

            var htmlResources = await LNUWebProcess.GetLNUFromLeftRequest(MainPage.LoginClient, currentUri.ToString());

            await CacheHelpers.SaveSpecificCacheValue(MainPage.LoginCache.UserID, htmlResources);

            var nameList = DataProcess.FetchScheduleTableFromHtml(htmlResources);

            TableGrid.Children.Clear();
            // Show the schedule table
            InitTableView(nameList);

            var list = DataProcess.FetchScheduleListFromHtml(htmlResources);

            ScheduleQueue.Clear();
            ScheduleQueue.AddRange(list);
            nameList.ForEach(item => { // finish lecture message into ScheduleQueue items .
                ScheduleQueue.FindAll(i => i.Title == GetSingleTitle(item.WholeTitle)).ForEach(s => { if (s.Lecturer == null)
                                                                                                      {
                                                                                                          s.Lecturer = GetLecturerName(item.WholeTitle);
                                                                                                      }
                                                                                               });
            });

            CourseListView.ItemsSource = ScheduleQueue;

            contentRing.IsActive = false;
        }
Exemplo n.º 11
0
        private void btn_Go_Click(object sender, EventArgs e)
        {
            if (!IsFinishConfig)
            {
                OpenSettingDig();
            }
            if (!IsFinishConfig)
            {
                MessageBox.Show("未设置组");
                return;
            }

            UpdateDest();
            List <DataTable> ds = new List <DataTable>()
            {
                DataProcess.T1(DestInfos),
                DataProcess.T2(DestInfos),
                DataProcess.T2_5(DestInfos),

                DataProcess.T4(DestInfos),
                DataProcess.T3(DestInfos),
                DataProcess.T5(DestInfos)
            };
            int index = 0;

            string[] names = Common.GetConfig("T_Names").Split(',');
            ds.ForEach(x => x.TableName = names[index++]);
            NPOIHelper.ExportSimple(ds, "C:\\1q.xlsx");
            MessageBox.Show("导出完成");
        }
Exemplo n.º 12
0
    public static List <BSPost> GetPostsByTitle(string title, int iUserId)
    {
        List <BSPost> posts = new List <BSPost>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("Title", title);
            if (iUserId == 0)
            {
                dp.ExecuteReader("SELECT * FROM [Posts] WHERE [Title] LIKE '%' + @Title + '%' ORDER By [CreateDate] DESC,[Title]");
            }
            else
            {
                dp.AddParameter("UserID", iUserId);
                dp.ExecuteReader("SELECT * FROM [Posts] WHERE [Title] LIKE '%' + @Title + '%' AND [UserID]=@UserID ORDER By [CreateDate] DESC,[Title]");
            }


            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSPost bsPost = new BSPost();
                        FillPost(dr, bsPost);
                        posts.Add(bsPost);
                    }
                }
            }
        }
        return(posts);
    }
Exemplo n.º 13
0
        /// <summary>
        /// 外部调用
        /// </summary>
        /// <param name="applyID"></param>
        public void PrintPreviewInvoke(string applyID)
        {
            DataProcess dp = (DataProcess)com.digitalwave.iCare.common.clsObjectGenerator.objCreatorObjectByType(typeof(DataProcess));
            DataTable   ds = dp.SqlSelect("select * from AR_COMMON_APPLY where ApplyID = " + applyID);

            this.dr = ds.Rows[0];
        }
Exemplo n.º 14
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MainPage.Current.BaseListRing.IsActive = true;
            GridViewResources.Source = null;
            var args = (sender as Pivot).SelectedItem as BarItemModel;

            if (args == null)
            {
                MainPage.Current.BaseListRing.IsActive = false;
                return;
            }
            MainPage.ChangeTitlePath(3, (sender as Pivot).SelectedIndex == 0 ? null : args.Title);
            ArgsPathKey = args.PathUri.ToString();
            if (IfContainsListInstance(ArgsPathKey))
            {
                GridViewResources.Source = GetListInstance(ArgsPathKey);
                MainPage.Current.BaseListRing.IsActive = false;
                return;
            }
            if (IfContainsAGVInstance(ArgsPathKey))
            {
                GetAGVInstance(ArgsPathKey).Opacity = 0;
            }
            var newList = DataProcess.FetchNewsPreviewFromHtml(
                (await WebProcess.GetHtmlResources(
                     ArgsPathKey, false))
                .ToString());

            GridViewResources.Source            = newList;
            GetAGVInstance(ArgsPathKey).Opacity = 1;
            AddResourcesInDec(ArgsPathKey, newList);
            MainPage.Current.BaseListRing.IsActive = false;
        }
Exemplo n.º 15
0
        protected void BindData()
        {
            DataProcess.DepartmentBind(department);
            DataProcess.PoliticBind(PolDP);
            DataProcess.XueliBind(XueliDP);

            if (zpitmid != -1)
            {
                YpFbList.DataSource = FTInterviewBLL.ZhaopinFbManage.GetAllZhaopinItem(zpitmid);
                YpFbList.DataBind();
            }
            YpFbList.Items.Insert(0, new ListItem("请选择", "-1"));

            if (ypzid != -1)
            {
                Yingpinzhe ypz = FTInterviewBLL.YingpinzheManage.GetYingpinzheById(ypzid);
                name.Value               = ypz.Name;
                SexDP.SelectedValue      = ypz.Sex;
                Birthday.Value           = ypz.Birthday;
                department.SelectedValue = ypz.DepartId + "";
                Duty.Value               = ypz.PositionName;
                XueliDP.SelectedValue    = ypz.XueliId + "";
                join_time.Value          = ypz.JoinTime;
                PolDP.SelectedValue      = ypz.PoliticId + "";

                //ZhaopinGw zg = FTInterviewBLL.ZhaopinGwManage.GetZhaopinGwByid(ypz.ZpfbId);
                YpFbList.SelectedValue = ypz.ZpfbId + "";
            }
        }
Exemplo n.º 16
0
    void Comment_Approved(object sender, EventArgs e)
    {
        BSComment bsComment = (BSComment)sender;

        if (bsComment.Approve)
        {
            using (DataProcess dp = new DataProcess())
            {
                dp.AddParameter("PostID", bsComment.PostID);
                dp.AddParameter("NotifyMe", true);
                dp.AddParameter("Approve", true);

                dp.ExecuteReader("SELECT DISTINCT Email FROM Comments WHERE PostID=@PostID AND NotifyMe=@NotifyMe AND Approve=@Approve");
                if (dp.Return.Status == DataProcessState.Success)
                {
                    BSPost bsPost = BSPost.GetPost(bsComment.PostID);
                    using (IDataReader dr = dp.Return.Value as IDataReader)
                    {
                        while (dr.Read())
                        {
                            string strEmail = (string)dr["Email"];
                            System.Threading.ThreadPool.QueueUserWorkItem(delegate
                            {
                                BSHelper.SendMail(Language.Get["NewCommentNotice"], Blogsa.Settings["smtp_email"].ToString(), Blogsa.Settings["smtp_name"].ToString()
                                                  , strEmail, "", Language.Get["NewCommentNoticeDescription"]
                                                  + "<br><br><a href=\"" + bsPost.Link + "\">" + bsPost.Title + "</a>", true);
                            });
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 17
0
        /// <summary>
        /// 写入文章的回帖
        /// </summary>
        /// <param name="PostId"></param>
        /// <returns></returns>
        public ActionResult WritePoastReply()
        {
            try
            {
                IdentityTicket user = IdentityManager.GetIdentFromAll();
                if (user == null || user.IsLife == false)
                {
                    //这边应该做一个跳转操作的 -- 待写
                    //return RedirectToAction("Login", "User");
                    return(DataProcess.Failure("先登入吧~").ToMvcJson());
                }
                string content = Request.Form["content"];
                string pid     = Request.Form["pid"];

                //如果存在@则代表为二级回复
                if (content.Contains('@'))
                {
                    //pid = pid.Split('@')[1];//由于之前做二级回帖用到
                    return(PostsContract.WritePoastReplyClone(user.UserId, pid, content).ToMvcJson("yyyy-MM-dd HH:mm:ss"));
                }
                else
                {
                    //PostsContract.WritePoastReply(user.UserId, PostId, content);
                    return(PostsContract.WritePoastReply(user.UserId, pid, content).ToMvcJson("yyyy-MM-dd HH:mm:ss"));
                }
            }
            catch (Exception ex)
            {
                return(DataProcess.Failure("写回帖出错了").ToMvcJson());
            }
        }
Exemplo n.º 18
0
 //获取存档文件,并初始化
 public KeepData GetSaveData(bool isInit = false)
 {
     //强制初始化,并返回
     if (isInit)
     {
         InitSaveData();
         return(_save);
     }
     // 如果save为null
     if (_save == null)
     {
         //如果save不存在,对save文件进行初始化
         if (!DataProcess.IsGameDataExist(_SAVE_NAME))
         {
             Debug.Log("不存在存档");
             InitSaveData();
             return(_save);
         }
         //存在存档文件,读取并返回
         _save = LoadGameData();
         Debug.Log(_save._Gold);
         return(_save);
     }
     //如果存档已存在,直接返回
     return(_save);
 }
Exemplo n.º 19
0
        private async Task <ItemGroup <BookItem> > FetchMessageFromAPIAsync(
            string headString,
            string loc_id = "108288",
            uint start    = 0,
            uint count    = 8,
            int offset    = 0)
        {
            var gmodel = default(ItemGroup <BookItem>);

            try {
                var minised = (DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;
                var result  = await BeansproutRequestHelper.FetchTypeCollectionList(headString, loc_id, start, count, minised, SubjectType.Music);

                if (result == null)
                {
                    ReportWhenGoesWrong("WebActionError");
                    return(gmodel);
                }
                JObject jo = JObject.Parse(result);
                gmodel = DataProcess.SetGroupResources(jo, gmodel);
                gmodel = SetSingletonResources(jo, gmodel);
            } catch { ReportHelper.ReportAttentionAsync(GetUIString("FetchJsonDataError")); }
            IncrementalLoadingBorder.SetVisibility(false);
            return(gmodel);
        }
Exemplo n.º 20
0
        public FileStreamResult DownAnaysleFile(int id)
        {
            string dataPath = GetDataPath(id.ToString());
            List <StatsisLib.BaseDataInfo> infos = null;

            if (!System.IO.File.Exists(dataPath))
            {
                return(null);
            }
            else
            {
                infos = infos.Deserialize(dataPath);
            }
            UnionLib.AnaysleService service = new UnionLib.AnaysleService();
            var tb = DataProcess.T1_0(infos);

            tb.TableName = "调整后的";
            string path = GetDataPath_excel(id.ToString());

            NPOIHelper.ExportSimple(new List <System.Data.DataTable>()
            {
                tb
            }, path);

            var fileStream = new FileStream(path, FileMode.Open);

            return(File(fileStream, "application/octet-stream", Server.UrlEncode(path)));
        }
Exemplo n.º 21
0
        private void LoadData()
        {
            DataProcess <News_Catagories> daNewCategory = new DataProcess <News_Catagories>();

            rptNewsCategory.DataSource = daNewCategory.Select();
            rptNewsCategory.DataBind();
        }
Exemplo n.º 22
0
 public static int GetReadCounts(int iPostID)
 {
     using (DataProcess dp = new DataProcess())
     {
         if (iPostID > 0)
         {
             dp.AddParameter("PostID", iPostID);
             dp.ExecuteScalar("SELECT SUM([ReadCount]) FROM Posts WHERE [PostID] = @PostID");
         }
         else
         {
             dp.ExecuteScalar("SELECT SUM([ReadCount]) FROM Posts");
         }
         if (dp.Return.Status == DataProcessState.Success)
         {
             if (dp.Return.Value != DBNull.Value)
             {
                 return(Convert.ToInt32(dp.Return.Value));
             }
             else
             {
                 return(0);
             }
         }
     }
     return(0);
 }
Exemplo n.º 23
0
        private void SetID()
        {
            if (SaveOldID == "")
            {
                DataProcess.SetCanID(txtCanID.Text);
                DataProcess.SendOrderToCan(AdjustID(1, txtCanID.Text));
            }
            else
            {
                if (SaveOldID != txtCanID.Text)
                {
                    DataProcess.SendOrderToCan(AdjustID(1, txtCanID.Text));
                    System.Threading.Thread.Sleep(50);
                    DataProcess.SetCanID(txtCanID.Text);
                }
                else
                {
                    DataProcess.SendOrderToCan(AdjustID(1, txtCanID.Text));
                    DataProcess.SetCanID(txtCanID.Text);
                }
            }
            SaveOldID = txtCanID.Text;


            DataProcess.SendOrderToCan(AdjustSleep(ComboSleep.SelectedIndex));
            DataProcess.SendOrderToCan(Adjustwatchdog(Combowatchdog.SelectedIndex));

            //  DataProcess.SetCanID(SaveOldID);
        }
Exemplo n.º 24
0
        //打开下拉框
        private void SerialSclectComBox_DropDownOpened(object sender, EventArgs e)
        {
            //每次点击串口选择下拉框时获取当前电脑上的com设备,并判断是否在下拉框中,如果没有,则添加
            List <string> ComList = new List <string>();

            ComList = DataProcess.GetSerialPortInfo();
            try
            {
                foreach (string PerCom in ComList)
                {
                    if (!SerialSclectComBox.DropDownItems.ContainsKey(PerCom))
                    {
                        ToolStripMenuItem toolStripItem = new ToolStripMenuItem();
                        toolStripItem.Name         = PerCom;
                        toolStripItem.CheckOnClick = true;
                        toolStripItem.Text         = PerCom;
                        SerialSclectComBox.DropDownItems.Add(toolStripItem);
                    }
                }
            }
            catch
            {
                return;
            }
        }
Exemplo n.º 25
0
        //窗体加载
        private void Form1_Load(object sender, EventArgs e)
        {
            List <string> ComList = new List <string>();

            //窗口初始化首先获取串口连接信息,用于渲染下拉菜单
            ComList = DataProcess.GetSerialPortInfo();
            try
            {
                foreach (string PerCom in ComList)
                {
                    ToolStripMenuItem toolStripItem = new ToolStripMenuItem(); //新创建一个下拉菜单项
                    toolStripItem.Name         = PerCom;                       //
                    toolStripItem.CheckOnClick = true;
                    toolStripItem.Text         = PerCom;                       //text
                    SerialSclectComBox.DropDownItems.Add(toolStripItem);       //添加到下拉列表中
                }
            }
            catch
            {
                return;
            }
            //插入树节点
            LoadTreeNodes();
            flashToolStripMenuItem.SelectedIndex = 0;
        }
Exemplo n.º 26
0
        private void KullaniciAdlariniDoldur()
        {
            try
            {
                DataTable dt = new DataProcess().GetDataTableFromList(entities.user.ToList());

                cboxKadi.DataSource    = entities.user.ToList();
                cboxKadi.DisplayMember = "name";
                cboxKadi.ValueMember   = "id";
                cboxKadi.Invalidate();
                if (cboxKadi.Items.Count > 0)
                {
                    //   int varsayilanId = Convert.ToInt32(Settings.Default.VarsayilanKullanici);
                    int varsayilanId = 1;
                    if (varsayilanId != 1)
                    {
                        cboxKadi.SelectedValue = varsayilanId;
                    }

                    if (cboxKadi.SelectedValue == null || varsayilanId == 1)
                    {
                        cboxKadi.SelectedItem = cboxKadi.Items[0];
                    }
                }
            }
            catch (Exception ex)
            {
                ShowMessage.Error("Lütfen tekrar deneyin. Eğer sorununuz devam ediyorsa sistem yöneticisine başvurmayı deneyin.\n\nAyrıca http://www.kodvizit.com adresinden de destek alabilirsiniz.\n\n" + ex.Message.ToString());
                Log.Error("[Veri Çekme Hatası] Kullanıcı isimleri doldurulamadı", ex);
            }
        }
Exemplo n.º 27
0
 //获取当前用户对当前帖子的收藏状态
 public ActionResult GetTitleState(string PostId)
 {
     try
     {
         if (PostId == "" || PostId == null)
         {
             return(DataProcess.Failure().ToMvcJson());
         }
         IdentityTicket identtity = IdentityManager.GetIdentFromAll();
         if (identtity != null)
         {
             if (PostsContract.JudgePostByUserId(identtity.UserId, PostId).Success)
             {
                 return(PostsContract.GetCollectState(identtity.UserId, PostId).ToMvcJson());
             }
             else
             {
                 return(DataProcess.Failure().ToMvcJson());
             }
         }
         else
         {
             return(DataProcess.Failure().ToMvcJson());
         }
     }
     catch (Exception ex)
     {
         return(DataProcess.Failure(ex.Message).ToMvcJson());
     }
 }
Exemplo n.º 28
0
        public string GenerateRefNo(string connectionString, string companyID, string branchID, DateTime requisitionDate, int refNoFor)
        {
            DateTime dt = Convert.ToDateTime(requisitionDate);
            int      maxnofromDate;
            string   refno;
            string   SQLStatement;

            maxnofromDate = 0;
            refno         = clsDateProcess.DateToNumber(requisitionDate);

            // By Date
            SQLStatement = "select count(ItemRequisitionNo)+1  as ItemRequisitionMaxNo from ItemRequisitionHeader WHERE  RequisitionDate =convert(datetime,'" + requisitionDate + "',103) and CompanyID = " + companyID + " AND BranchID = " + branchID + "";


            maxnofromDate = DataProcess.GetMaximumValueUsingSQL(connectionString, SQLStatement);
            refno         = refno + string.Format("{0:00}", maxnofromDate);

            // By Month

            SQLStatement = "select count(ItemRequisitionNo)+1  as ItemRequisitionMaxNo from ItemRequisitionHeader WHERE  month(RequisitionDate) =" + requisitionDate.Month + " and year(RequisitionDate) =" + requisitionDate.Year + " and CompanyID = " + companyID + " AND BranchID = " + branchID + "";


            maxnofromDate = DataProcess.GetMaximumValueUsingSQL(connectionString, SQLStatement);
            refno         = refno + string.Format("{0:0000}", maxnofromDate);

            return(refno);
        }
        static void Main(string[] args)
        {
            Console.Write("Use default StoreId, ItemId and 4 weeks to predict? ");
            var         useDefault     = Console.ReadLine().ToUpper() == "Y";
            DataProcess dataprocess    = new DataProcess();
            var         predictionList = new List <ForecastingData>();

            if (useDefault)
            {
                var data = dataprocess.GetProcessedDataForScore(storeID1: 2, itemID2: 1, weeksToPredict: 4);
                predictionList = data.TakeLast(4).ToList();
            }
            else
            {
                // Get values from user to parse dataset.
                Console.Write("Enter Store Id: ");
                var storeId = Convert.ToInt32(Console.ReadLine());
                Console.Write("Enter Item Id: ");
                var itemId = Convert.ToInt32(Console.ReadLine());
                Console.Write("Enter weeks to predict: ");
                var weeksToPredict = Convert.ToInt32(Console.ReadLine());

                // Get processed data.
                var data = dataprocess.GetProcessedDataForScore(storeId, itemId, weeksToPredict);
                predictionList = data.TakeLast(weeksToPredict).ToList();
            }

            //Post to api for predictions
            InvokeRequestResponseService(predictionList).Wait();
        }
Exemplo n.º 30
0
    public KeepData LoadGameData()
    {
        //读取文档
        KeepData readGold = DataProcess.LoadGameData(typeof(KeepData), _SAVE_NAME, false) as KeepData;

        return(readGold);
    }
Exemplo n.º 31
0
    void Comment_Approved(object sender, EventArgs e)
    {
        BSComment bsComment = (BSComment)sender;
        if (bsComment.Approve)
        {
            using (DataProcess dp = new DataProcess())
            {
                dp.AddParameter("PostID", bsComment.PostID);
                dp.AddParameter("NotifyMe", true);
                dp.AddParameter("Approve", true);

                dp.ExecuteReader("SELECT DISTINCT Email FROM Comments WHERE PostID=@PostID AND NotifyMe=@NotifyMe AND Approve=@Approve");
                if (dp.Return.Status == DataProcessState.Success)
                {
                    BSPost bsPost = BSPost.GetPost(bsComment.PostID);
                    using (IDataReader dr = dp.Return.Value as IDataReader)
                    {
                        while (dr.Read())
                        {
                            string strEmail = (string)dr["Email"];
                            System.Threading.ThreadPool.QueueUserWorkItem(delegate
                            {
                                BSHelper.SendMail(Language.Get["NewCommentNotice"], Blogsa.Settings["smtp_email"].ToString(), Blogsa.Settings["smtp_name"].ToString()
                                    , strEmail, "", Language.Get["NewCommentNoticeDescription"]
                                    + "<br><br><a href=\"" + bsPost.Link + "\">" + bsPost.Title + "</a>", true);
                            });
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 32
0
    public static string GetWidgetState(string FolderName)
    {
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("FolderName", FolderName);
            dp.ExecuteScalar("SELECT WidgetID FROM Widgets WHERE FolderName = @FolderName");

            if (dp.Return.Status == DataProcessState.Success)
                return (string)dp.Return.Value;
            else
                return string.Empty;
        }
    }
Exemplo n.º 33
0
 public void SaveData(int ObjectID)
 {
     using (DataProcess dp = new DataProcess())
     {
         BSTerm.RemoveTo(TermTypes.Category, ObjectID);
         for (int i = 0; i < cblCats.Items.Count; i++)
         {
             if (cblCats.Items[i].Selected == true)
             {
                 BSTerm bsTerm = BSTerm.GetTerm(Convert.ToInt32(cblCats.Items[i].Value));
                 bsTerm.Objects.Add(ObjectID);
                 bsTerm.Save();
             }
         }
     }
 }
Exemplo n.º 34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(SearchText))
            Response.Redirect("~/");

        using (DataProcess dp = new DataProcess())
        {
            try
            {
                dp.AddParameter("Content", SearchText);
                dp.ExecuteReader("SELECT * FROM Posts WHERE Type = 0 AND State = 1 AND (Content LIKE @Content + ' %' OR Content LIKE '% ' + @Content OR Content LIKE '% ' + @Content + ' %')");

                int p = 0;
                int.TryParse(Request["p"], out p);

                p = p == 0 ? 1 : p;

                IDataReader dr = dp.Return.Value as IDataReader;

                List<BSPost> posts = new List<BSPost>();

                while (dr.Read())
                {
                    BSPost post = new BSPost();
                    BSPost.FillPost(dr, post);
                    posts.Add(post);
                }

                if (posts.Count > 0)
                {
                    ltResult.Text = String.Format(Language.Get["SearchFoundedItemCount"], String.Format("<b>{0}</b>", posts.Count));
                }
                else
                    ltResult.Text = Language.Get["SearchNotFound"];

                ltPaging.Visible = posts.Count > 0;

                rpSearch.DataSource = Data.Paging(posts, p, ltPaging);
                rpSearch.DataBind();
            }
            catch (Exception)
            {
            }
        }
    }
Exemplo n.º 35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            List<BSPost> posts = new List<BSPost>();

            using (DataProcess dp = new DataProcess())
            {
                dp.AddParameter("PostID", BSPost.CurrentPost.PostID);
                dp.AddParameter("Title", BSPost.CurrentPost.Title);
                dp.ExecuteReader("SELECT TOP 5 * FROM Posts WHERE [PostID]<>@PostID AND [Type]=0 AND [State]=1 AND ([Title] Like '%'+@Title+'%' OR Content Like '%'+@Title+'%') ORDER BY [CreateDate] DESC");

                if (dp.Return.Status == DataProcessState.Success)
                {
                    using (IDataReader dr = dp.Return.Value as IDataReader)
                    {
                        while (dr.Read())
                        {
                            BSPost bsPost = new BSPost();
                            BSPost.FillPost(dr, bsPost);
                            posts.Add(bsPost);
                        }
                    }
                }
            }

            if (posts.Count > 0)
            {
                rpRelatedPosts.DataSource = posts;
                rpRelatedPosts.DataBind();
            }
            else
                this.Visible = false;
        }
        catch (System.Exception ex)
        {
        }
    }
Exemplo n.º 36
0
    public bool Save()
    {
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("ParentID", this.ParentID);
            dp.AddParameter("UserID", this.UserID);
            dp.AddParameter("Code", this.Code);
            dp.AddParameter("State", this.State);

            string sql = "INSERT INTO Sites([ParentID],[UserID],[Code],[State]) "
                      + "VALUES(@ParentID,@UserID,@Code,@State);";

            if (SiteID != 0)
            {
                sql =
                    "UPDATE Settings SET [ParentID]=@ParentID,[UserID]=@UserID,[Code]=@Code,[State]=@State WHERE [SiteID] = @SiteID;";
                dp.AddParameter("SiteID", this.SiteID);
            }

            dp.ExecuteNonQuery(sql);

            return dp.Return.Status == DataProcessState.Success;
        }
    }
Exemplo n.º 37
0
        private List<object> GenerateData(object entity, string gridName, List<SoaDataGridColumn> columns)
        {
            Dictionary<string, object> dict;
            using (DataProcess dp = new DataProcess())
            {
                dict = dp.Process(entity, gridName);
            }

            List<object> ret = new List<object>();

            foreach (SoaDataGridColumn col in columns)
            {
                if (dict.ContainsKey(col.Name))
                {
                    ret.Add(dict[col.Name]);
                }
                else
                {
                    object o = null;
                    try
                    {
                        o = EntityHelper.GetPropertyValue(entity, col.Name);
                    }
                    catch (Exception)    // 不一定有这个属性,例如大写金额
                    {
                    }
                    ret.Add(o);
                }
            }

            return ret;
        }
Exemplo n.º 38
0
    public static List<BSWidget> GetWidgetsByColumnValue(string column, object value, int widgetCount, string orderBy)
    {
        List<BSWidget> widgets = new List<BSWidget>();
        using (DataProcess dp = new DataProcess())
        {
            string top = widgetCount > 0 ? "TOP " + widgetCount : String.Empty;

            if (!String.IsNullOrEmpty(column) && value != null)
            {
                dp.AddParameter(column, value);
                dp.ExecuteReader(String.Format("SELECT {0} * FROM [Widgets] WHERE [{1}]=@{1} {2}", top, column, orderBy));
            }
            else
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM [Widgets] {1}", top, orderBy));
            }
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();
                        FillWidget(dr, bsWidget);
                        widgets.Add(bsWidget);
                    }
                }
            }
        }
        return widgets;
    }
Exemplo n.º 39
0
    public static BSSettings GetSettings()
    {
        BSSettings settings = new BSSettings();

        using (DataProcess dp = new DataProcess())
        {
            dp.ExecuteReader("SELECT * FROM Settings");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSSetting bsSetting = new BSSetting();

                        FillValue(dr, bsSetting);

                        settings.Add(bsSetting);
                    }
                }
            }
        }

        return settings;
    }
Exemplo n.º 40
0
    public bool Remove()
    {
        using (DataProcess dp = new DataProcess())
        {
            //CancelEventArgs cancelEvent = new CancelEventArgs();
            //OnDeleting(this, cancelEvent);
            //if (!cancelEvent.Cancel)
            //{
            dp.AddParameter("MenuGroupID", MenuGroupID);
            dp.ExecuteNonQuery("DELETE FROM [MenuGroups] WHERE [MenuGroupID] = @MenuGroupID");

            if (dp.Return.Status == DataProcessState.Success)
            {
                //OnDeleted(this, null);
                return true;
            }
            //}
        }
        return false;
    }
Exemplo n.º 41
0
    public static BSMenuGroup GetDefault()
    {
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("Default", true);
            dp.ExecuteReader("SELECT * FROM [MenuGroups] WHERE [Default]=@Default");
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    if (dr != null && dr.Read())
                    {
                        BSMenuGroup menuGroup = new BSMenuGroup();
                        FillMenuGroup(dr, menuGroup);
                        return menuGroup;
                    }
                }
            }
        }

        BSMenuGroup defaultMenuGroup = new BSMenuGroup();
        return defaultMenuGroup;
    }
Exemplo n.º 42
0
 public bool Remove()
 {
     using (DataProcess dp = new DataProcess())
     {
         CancelEventArgs cancelEvent = new CancelEventArgs();
         OnDeleting(this, cancelEvent);
         if (!cancelEvent.Cancel)
         {
             dp.AddParameter("CommentID", CommentID);
             dp.ExecuteNonQuery("DELETE FROM Comments WHERE [CommentID] = @CommentID");
             if (dp.Return.Status == DataProcessState.Success)
             {
                 OnDeleted(this, null);
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 43
0
 public static BSMenuGroup GetMenuGroup(string menuCode)
 {
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("Code", menuCode);
         dp.ExecuteReader("SELECT * FROM [MenuGroups] WHERE [Code]=@Code");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 if (dr != null && dr.Read())
                 {
                     BSMenuGroup menuGroup = new BSMenuGroup();
                     FillMenuGroup(dr, menuGroup);
                     return menuGroup;
                 }
             }
         }
     }
     return null;
 }
Exemplo n.º 44
0
    public static List<BSWidget> GetWidgets()
    {
        List<BSWidget> widgets = new List<BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            dp.ExecuteReader("SELECT * FROM [Widgets] ORDER BY [Sort]");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();
                        FillWidget(dr, bsWidget);
                        widgets.Add(bsWidget);
                    }
                }
            }
        }

        return widgets;
    }
Exemplo n.º 45
0
    public bool Save()
    {
        bool bReturnValue = false;
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("UserID", UserID);
            dp.AddParameter("PostID", PostID);
            dp.AddParameter("Name", UserName);
            dp.AddParameter("Comment", Content);
            dp.AddParameter("Email", Email);
            dp.AddParameter("WebPage", WebPage);
            dp.AddParameter("Ip", IP);
            dp.AddParameter("CreateDate", Date);
            dp.AddParameter("Approve", Approve);
            dp.AddParameter("NotifyMe", NotifyMe);

            if (CommentID != 0)
            {
                dp.AddParameter("CommentID", CommentID);

                dp.ExecuteNonQuery("UPDATE Comments SET [UserID]=@UserID,[PostID]=@PostID,[Name]=@Name,[Comment]=@Comment,"
                    + "[Email]=@Email,[WebPage]=@WebPage,[Ip]=@Ip,[CreateDate]=@CreateDate,[Approve]=@Approve,[NotifyMe]=@NotifyMe WHERE [CommentID] = @CommentID");
                bReturnValue = dp.Return.Status == DataProcessState.Success;
            }
            else
            {
                dp.ExecuteNonQuery("INSERT INTO Comments([UserID],[PostID],[Name],[Comment],[Email],[WebPage],[Ip],[CreateDate],[Approve],[NotifyMe]) "
                    + "VALUES(@UserID,@PostID,@Name,@Comment,@Email,@WebPage,@Ip,@CreateDate,@Approve,@NotifyMe)");
                bReturnValue = dp.Return.Status == DataProcessState.Success;

                if (bReturnValue)
                {
                    dp.ExecuteScalar("SELECT @@IDENTITY");
                    if (dp.Return.Status == DataProcessState.Success)
                    {
                        CommentID = Convert.ToInt32(dp.Return.Value);
                    }
                }
            }
        }
        return bReturnValue;
    }
Exemplo n.º 46
0
 public static List<BSMenu> GetMenus(int menuGroupID)
 {
     List<BSMenu> menus = new List<BSMenu>();
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("MenuGroupID", menuGroupID);
         dp.ExecuteReader("SELECT * FROM [Menus] WHERE [MenuGroupID]=@MenuGroupID ORDER BY [Sort]");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 while (dr != null && dr.Read())
                 {
                     BSMenu menu = new BSMenu();
                     FillMenu(dr, menu);
                     menus.Add(menu);
                 }
             }
         }
     }
     return menus;
 }
Exemplo n.º 47
0
    public static BSSetting GetSetting(int iSettingID)
    {
        BSSetting bsSetting = new BSSetting();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("SettingID", iSettingID);

            dp.ExecuteReader("SELECT * FROM Settings WHERE SettingID = @SettingID");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    if (dr.Read())
                    {
                        FillValue(dr, bsSetting);

                        return bsSetting;
                    }
                }
            }
        }

        return null;
    }
Exemplo n.º 48
0
    public bool Save()
    {
        DataProcess dp = new DataProcess();

        string sql = String.Empty;

        if (SettingID == 0)
            sql = "INSERT INTO Settings([SiteID],[Name],[Value],[Title],[Description],[Main],[Sort],[Visible]) "
                  + "VALUES(@SiteID,@Name,@Value,@Title,@Description,@Main,@Sort,@Visible);";
        else
            sql = "UPDATE Settings SET [SiteID]=@SiteID,[Name]=@Name,[Value]=@Value,[Title]=@Title,[Description]=@Description,[Main]=@Main,[Sort]=@Sort,[Visible]=@Visible WHERE [SettingID] = @SettingID;";

        dp.AddParameter("SiteID", this.SiteID);
        dp.AddParameter("Name", this.Name);
        dp.AddParameter("Value", this.Value);
        dp.AddParameter("Title", this.Title);
        dp.AddParameter("Description", this.Description);
        dp.AddParameter("Main", this.Main);
        dp.AddParameter("Sort", this.Sort);
        dp.AddParameter("Visible", this.Visible);

        if (SettingID != 0)
            dp.AddParameter("SettingID", this.SettingID);

        dp.ExecuteNonQuery(sql);

        return dp.Return.Status == DataProcessState.Success;
    }
Exemplo n.º 49
0
    public bool Save()
    {
        bool bReturnValue = false;
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("SiteID", this.SiteID);
            dp.AddParameter("Description", this.Description);
            dp.AddParameter("FolderName", this.FolderName);
            dp.AddParameter("PlaceHolder", this.PlaceHolder);
            dp.AddParameter("Sort", this.Sort);
            dp.AddParameter("Title", this.Title);
            dp.AddParameter("Visible", this.Visible);
            dp.AddParameter("Type", this.Type);
            dp.AddParameter("LanguageCode", this.LanguageCode);

            if (WidgetID != 0)
            {
                dp.AddParameter("WidgetID", WidgetID);

                dp.ExecuteNonQuery("UPDATE Widgets SET [SiteID]=@SiteID,[Description]=@Description,[FolderName]=@FolderName,[PlaceHolder]=@PlaceHolder,[Sort]=@Sort,"
                    + "[Title]=@Title,[Visible]=@Visible,[Type]=@Type,[LanguageCode]=@LanguageCode WHERE [WidgetID] = @WidgetID");
                bReturnValue = dp.Return.Status == DataProcessState.Success;
            }
            else
            {
                dp.ExecuteNonQuery("INSERT INTO Widgets([SiteID],[Description],[FolderName],[PlaceHolder],[Sort],[Title],[Visible],[Type],[LanguageCode]) "
                    + "VALUES(@SiteID,@Description,@FolderName,@PlaceHolder,@Sort,@Title,@Visible,@Type,@LanguageCode)");
                bReturnValue = dp.Return.Status == DataProcessState.Success;

                if (bReturnValue)
                {
                    dp.ExecuteScalar("SELECT @@IDENTITY");
                    if (dp.Return.Status == DataProcessState.Success)
                    {
                        WidgetID = Convert.ToInt32(dp.Return.Value);
                    }
                }
            }
        }
        return bReturnValue;
    }
Exemplo n.º 50
0
 public bool DoApprove(bool bApprove)
 {
     CancelEventArgs eventArgs = new CancelEventArgs();
     BSComment bsComment = GetComment(CommentID);
     OnApproving(bsComment, eventArgs);
     if (!eventArgs.Cancel)
     {
         using (DataProcess dp = new DataProcess())
         {
             dp.AddParameter("Approve", bApprove);
             dp.AddParameter("CommentID", CommentID);
             dp.ExecuteNonQuery("UPDATE Comments SET [Approve]=@Approve WHERE [CommentID]=@CommentID");
             if (dp.Return.Status == DataProcessState.Success)
             {
                 bsComment.Approve = bApprove;
                 OnApproved(bsComment, null);
                 return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 51
0
    public static List<BSWidget> GetWidgetsBySorted()
    {
        List<BSWidget> widgets = new List<BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("Visible", true);
            dp.ExecuteReader("SELECT * FROM Widgets WHERE [Visible] = @Visible ORDER BY [Sort]");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();

                        FillWidget(dr, bsWidget);

                        widgets.Add(bsWidget);
                    }
                }
            }
        }

        return widgets;
    }
Exemplo n.º 52
0
    public static List<BSComment> GetCommentsByUserID(int iUserID, CommentStates state)
    {
        List<BSComment> comments = new List<BSComment>();
        using (DataProcess dp = new DataProcess())
        {
            if (state == CommentStates.All)
            {
                dp.AddParameter("UserID", iUserID);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID ORDER By CreateDate DESC");
            }
            else
            {
                dp.AddParameter("UserID", iUserID);
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader("SELECT * FROM Comments WHERE [UserID]=@UserID AND [Approve]=@Approve ORDER By CreateDate DESC");
            }

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return comments;
    }
Exemplo n.º 53
0
 public static List<BSMenuGroup> GetMenuGroups()
 {
     List<BSMenuGroup> menuGroups = new List<BSMenuGroup>();
     using (DataProcess dp = new DataProcess())
     {
         dp.ExecuteReader("SELECT * FROM [MenuGroups]");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 while (dr != null && dr.Read())
                 {
                     BSMenuGroup menuGroup = new BSMenuGroup();
                     FillMenuGroup(dr, menuGroup);
                     menuGroups.Add(menuGroup);
                 }
             }
         }
     }
     return menuGroups;
 }
Exemplo n.º 54
0
    public static List<BSComment> GetComments(CommentStates state, int iCommentCount)
    {
        List<BSComment> comments = new List<BSComment>();
        using (DataProcess dp = new DataProcess())
        {
            string top = iCommentCount == 0 ? String.Empty : "TOP " + iCommentCount;

            if (state == CommentStates.All)
            {
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments ORDER By CreateDate DESC", top));
            }
            else
            {
                dp.AddParameter("Approve", state == CommentStates.Approved);
                dp.ExecuteReader(String.Format("SELECT {0} * FROM Comments WHERE [Approve]=@Approve ORDER By CreateDate DESC", top));
            }
            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr != null && dr.Read())
                    {
                        BSComment bsComment = new BSComment();
                        FillComment(dr, bsComment);
                        comments.Add(bsComment);
                    }
                }
            }
        }
        return comments;
    }
Exemplo n.º 55
0
    public bool Save()
    {
        bool bReturnValue = false;
        using (DataProcess dp = new DataProcess())
        {
            if (this.Default)
            {
                dp.AddParameter("Default", false);
                dp.ExecuteNonQuery("UPDATE [MenuGroups] SET [Default]=@Default");
            }

            dp.AddParameter("SiteID", this.SiteID);
            dp.AddParameter("Code", this.Code);
            dp.AddParameter("Description", this.Description);
            dp.AddParameter("Title", this.Title);
            dp.AddParameter("Default", this.Default);
            dp.AddParameter("LanguageCode", this.LanguageCode);

            if (MenuGroupID != 0)
            {
                dp.AddParameter("MenuGroupID", this.MenuGroupID);

                dp.ExecuteNonQuery("UPDATE [MenuGroups] SET [SiteID]=@SiteID,[Code]=@Code,[Description]=@Description,[Title]=@Title,[Default]=@Default,[LanguageCode]=@LanguageCode WHERE [MenuGroupID] = @MenuGroupID");
                bReturnValue = dp.Return.Status == DataProcessState.Success;

                if (bReturnValue)
                {
                    foreach (BSMenu bsMenu in Menu)
                    {
                        bsMenu.Save();
                    }
                }
            }
            else
            {
                dp.ExecuteNonQuery("INSERT INTO [MenuGroups]([SiteID],[Code],[Description],[Title],[Default],[LanguageCode]) VALUES(@SiteID,@Code,@Description,@Title,@Default,@LanguageCode)");
                bReturnValue = dp.Return.Status == DataProcessState.Success;

                if (bReturnValue)
                {
                    foreach (BSMenu bsMenu in Menu)
                    {
                        bsMenu.Save();
                    }

                    dp.ExecuteScalar("SELECT @@IDENTITY");
                    if (dp.Return.Status == DataProcessState.Success)
                    {
                        MenuGroupID = Convert.ToInt32(dp.Return.Value);
                    }
                }
            }
        }
        return bReturnValue;
    }
Exemplo n.º 56
0
 public static BSComment GetComment(int iCommentID)
 {
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("CommentID", iCommentID);
         dp.ExecuteReader("SELECT * FROM Comments WHERE [CommentID]=@CommentID");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 if (dr != null && dr.Read())
                 {
                     BSComment bsComment = new BSComment();
                     FillComment(dr, bsComment);
                     return bsComment;
                 }
             }
         }
     }
     return null;
 }
Exemplo n.º 57
0
    public static List<BSWidget> GetWidgetsByPlaceHolder(string placeHolder, bool visible)
    {
        List<BSWidget> widgets = new List<BSWidget>();

        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("PlaceHolder", placeHolder);
            dp.AddParameter("Visible", visible);
            dp.ExecuteReader("SELECT * FROM [Widgets] WHERE [PlaceHolder]=@PlaceHolder AND [Visible]=@Visible ORDER BY [Sort]");

            if (dp.Return.Status == DataProcessState.Success)
            {
                using (IDataReader dr = dp.Return.Value as IDataReader)
                {
                    while (dr.Read())
                    {
                        BSWidget bsWidget = new BSWidget();
                        FillWidget(dr, bsWidget);
                        widgets.Add(bsWidget);
                    }
                }
            }
        }

        return widgets;
    }
Exemplo n.º 58
0
    public static void Delete(int iCommentID)
    {
        CancelEventArgs eventArgs = new CancelEventArgs();
        BSComment bsComment = GetComment(iCommentID);
        BSComment.OnDeleting(bsComment, eventArgs);

        if (!eventArgs.Cancel)
        {
            using (DataProcess dp = new DataProcess())
            {
                dp.AddParameter("CommentID", iCommentID);
                dp.ExecuteReader("DELETE FROM Comments WHERE [CommentID]=@CommentID");
                if (dp.Return.Status == DataProcessState.Success)
                {
                    BSComment.OnDeleted(bsComment, EventArgs.Empty);
                }
            }
        }
    }
Exemplo n.º 59
0
 public static BSMenu GetMenu(int menuID)
 {
     using (DataProcess dp = new DataProcess())
     {
         dp.AddParameter("MenuID", menuID);
         dp.ExecuteReader("SELECT * FROM [Menus] WHERE [MenuID]=@MenuID");
         if (dp.Return.Status == DataProcessState.Success)
         {
             using (IDataReader dr = dp.Return.Value as IDataReader)
             {
                 if (dr != null && dr.Read())
                 {
                     BSMenu menu = new BSMenu();
                     FillMenu(dr, menu);
                     return menu;
                 }
             }
         }
     }
     return null;
 }
Exemplo n.º 60
0
    public bool Save()
    {
        bool bReturnValue = false;
        using (DataProcess dp = new DataProcess())
        {
            dp.AddParameter("Description", this.Description);
            dp.AddParameter("MenuGroupID", this.MenuGroupID);
            dp.AddParameter("MenuType", (short)this.MenuType);
            dp.AddParameter("ObjectID", this.ObjectID);
            dp.AddParameter("ObjectType", (short)this.ObjectType);
            dp.AddParameter("ParentID", this.ParentID);
            dp.AddParameter("Sort", this.Sort);
            dp.AddParameter("Target", this.Target);
            dp.AddParameter("Title", this.Title);
            dp.AddParameter("Url", this.Url);

            if (MenuID != 0)
            {
                dp.AddParameter("MenuID", MenuID);

                dp.ExecuteNonQuery("UPDATE [Menus] SET [Description]=@Description,[MenuGroupID]=@MenuGroupID,[MenuType]=@MenuType,"
                    + "[ObjectID]=@ObjectID,[ObjectType]=@ObjectType,[ParentID]=@ParentID,[Sort]=@Sort,[Target]=@Target,[Title]=@Title,[Url]=@Url WHERE [MenuID] = @MenuID");
                bReturnValue = dp.Return.Status == DataProcessState.Success;
            }
            else
            {
                dp.ExecuteNonQuery("INSERT INTO [Menus]([Description],[MenuGroupID],[MenuType],[ObjectID],[ObjectType],[ParentID],[Sort],[Target],[Title],[Url]) "
                    + "VALUES(@Description,@MenuGroupID,@MenuType,@ObjectID,@ObjectType,@ParentID,@Sort,@Target,@Title,@Url)");
                bReturnValue = dp.Return.Status == DataProcessState.Success;

                if (bReturnValue)
                {
                    dp.ExecuteScalar("SELECT @@IDENTITY");
                    if (dp.Return.Status == DataProcessState.Success)
                    {
                        MenuID = Convert.ToInt32(dp.Return.Value);
                    }
                }
            }
        }
        return bReturnValue;
    }