コード例 #1
0
        public static List <Recomment> GetToUploadList()
        {
            List <Recomment> list = new List <Recomment>();

            try
            {
                ISelectDataSourceFace query = new SelectSQL(TableName.Recomment);
                query.DataBaseAlias = Const.LogConnection;
                query.AddWhere("ImageStatus", ImageStatus.Local);
                DataSet ds = query.ExecuteDataSet();
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    list.AddRange(from DataRow dr in ds.Tables[0].Rows
                                  select new Recomment()
                    {
                        BlogId    = SafeValueHelper.ToInt32(dr["BlogId"]),
                        Category  = (RecommentCategory)SafeValueHelper.ToInt32(dr["Category"]),
                        CoverName = SafeValueHelper.ToString(dr["CoverName"]),
                        Id        = SafeValueHelper.ToInt32(dr["Id"]),
                        Title     = SafeValueHelper.ToString(dr["Title"]),
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(list);
        }
コード例 #2
0
        public static List <ImageUrl> GetToUploadList()
        {
            List <ImageUrl> list = new List <ImageUrl>();

            try
            {
                ISelectDataSourceFace query = new SelectSQL(TableName.ImageUrl);
                query.DataBaseAlias = Const.LogConnection;
                query.AddWhere("ImageStatus", ImageStatus.Local);
                DataSet ds = query.ExecuteDataSet();
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    list.AddRange(from DataRow dr in ds.Tables[0].Rows
                                  select new ImageUrl()
                    {
                        BlogId = SafeValueHelper.ToInt32(dr["BlogId"]),
                        Url    = SafeValueHelper.ToString(dr["Url"]),
                        Id     = SafeValueHelper.ToInt32(dr["Id"])
                    });
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }
            return(list);
        }
コード例 #3
0
ファイル: Product.cs プロジェクト: friendlww/zhoulb
        private void btnSearchProduct_Click(object sender, EventArgs e)
        {
            var selectsql = SelectSQL.SelectProduct(txtProductName.Text, txtProductCode.Text, txtRemark.Text);

            BindData.BingDataGridView(dgvProductInfo, selectsql);
            for (int i = 0; i < dgvProductInfo.Rows.Count; i++)
            {
                dgvProductInfo.Rows[i].Cells[0].Value = "修改商品";
                dgvProductInfo.Rows[i].Cells[1].Value = "删除商品";
            }
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: friendlww/zhoulb
        private void button1_Click(object sender, EventArgs e)
        {
            var selectsql = SelectSQL.SelectStatisticInfo(txtClientName.Text, txtClientPhone.Text, txtProductName.Text,
                                                          txtProductCode.Text, txtRemak.Text);

            DLL.BindData.BingDataGridView(dataGridView1, selectsql);
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                dataGridView1.Rows[i].Cells[0].Value = "图片";
            }
        }
コード例 #5
0
ファイル: Picture.cs プロジェクト: friendlww/zhoulb
 private void ShowPicture(string pictureId)
 {
     if (string.IsNullOrEmpty(pictureId) == false)
     {
         var selectsql = SelectSQL.SelectPictureWithId(pictureId);
         var dt        = DLL.BindData.ReturnDataTable(selectsql);
         if (dt != null && dt.Rows.Count > 0)
         {
             BackgroundImage = Image.FromFile(dt.Rows[0]["PicturePath"].ToString());
         }
     }
 }
コード例 #6
0
        public string GetSearchSQL()
        {
            var limitConditionString = (startAt == 1 && maxRecords == 0) ? string.Empty : $"LIMIT {startAt}, {maxRecords}";
            var sortByString         = string.IsNullOrEmpty(sortOrder) ? string.Empty : $"ORDER BY {SortBy} {SortOrder}";
            var whereString          = string.IsNullOrEmpty(WhereSQL) ? string.Empty : $"WHERE {WhereSQL}";

            var fromSqlString = SelectSQL.Trim().Substring(SelectSQL.Trim().IndexOf("FROM "), SelectSQL.Length - SelectSQL.Trim().IndexOf("FROM "));

            var sql = $@"{SelectSQL} {whereString} {sortByString} {limitConditionString};
                        SELECT COUNT(*) {fromSqlString} {whereString}";

            return(sql);
        }
コード例 #7
0
ファイル: ClientInfo.cs プロジェクト: friendlww/zhoulb
 private void ClientInfo_Load(object sender, System.EventArgs e)
 {
     if (_opearType == "修改")
     {
         var selectsql = SelectSQL.SelectClientWithId(_clientId);
         var dt        = DLL.BindData.ReturnDataTable(selectsql);
         if (dt != null && dt.Rows.Count > 0)
         {
             txtClientName.Text  = dt.Rows[0]["ClientName"].ToString();
             txtClientPhone.Text = dt.Rows[0]["ClientPhone"].ToString();
         }
         button1.Text = "修改";
     }
 }
コード例 #8
0
 private static DataSet GetAccountDataSet()
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL("UploadAccount");
         query.DataBaseAlias = "LogConnection";
         query.AddWhere("Enabled", true);
         return(query.ExecuteDataSet());
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(null);
     }
 }
コード例 #9
0
 public static bool ExistLocalImage(Recomment image)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.Recomment);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("CoverName", image.CoverName);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(false);
     }
 }
コード例 #10
0
        private void btnSearchClient_Click(object sender, EventArgs e)
        {
            var selectsql = SelectSQL.SelectClient(txtClientName.Text, txtClientPhone.Text);

            DLL.BindData.BingDataGridView(dgvClientInfo, selectsql);
            for (int i = 0; i < dgvClientInfo.Rows.Count; i++)
            {
                dgvClientInfo.Rows[i].Cells[0].Value = "修改客户";
                dgvClientInfo.Rows[i].Cells[1].Value = "删除客户";
            }
            if (_opearType == "关联客户")
            {
                dgvClientInfo.Columns[0].Visible = false;
                dgvClientInfo.Columns[1].Visible = false;
            }
        }
コード例 #11
0
 public static bool ExistRecord(string resourceId, ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.ResourceRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("ResourceId", resourceId.Trim());
         query.AddWhere("ResourceType", (int)type);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(true);
     }
 }
コード例 #12
0
 public static bool DailyFetched(ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.FetchRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.AddWhere("ResourceType", (int)type);
         query.AddWhere("TimeStamp", Comparison.GreaterThan, DateTime.Now.Date);
         return(query.ExecuteCount() > 0);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(true);
     }
 }
コード例 #13
0
 public static int ExistContinutedRecord(string resourceId, ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.ResourceRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.SelectColumn("BlogId");
         query.AddWhere("ResourceId", resourceId.Trim());
         query.AddWhere("ResourceType", (int)type);
         query.AddWhere("Continued", true);
         return(SafeValueHelper.ToInt32(query.ExecuteScalar()));
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(0);
     }
 }
コード例 #14
0
 public static int GetFetchId(ResourceType type)
 {
     try
     {
         ISelectDataSourceFace query = new SelectSQL(TableName.FetchRecord);
         query.DataBaseAlias = Const.LogConnection;
         query.SelectColumn("Id");
         query.AddWhere("ResourceType", (int)type);
         query.AddOrderBy("Id", Sort.Descending);
         query.Top = 1;
         return(SafeValueHelper.ToInt32(query.ExecuteScalar()));
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
         return(0);
     }
 }
コード例 #15
0
        /// <summary>
        /// Returns true if the SELECT SQL is different from the fully qualified underlying column name e.g. 'UPPER(MyCol)' would return true.
        ///
        /// <para>Also returns true if the column is hashed</para>
        /// </summary>
        /// <returns></returns>
        public bool IsProperTransform()
        {
            if (string.IsNullOrWhiteSpace(SelectSQL))
            {
                return(false);
            }

            if (ColumnInfo == null)
            {
                return(false);
            }

            if (HashOnDataRelease)
            {
                return(true);
            }

            //if the selct sql is different from the column underlying it then it is a proper transform (not just a copy paste)
            return(!SelectSQL.Equals(ColumnInfo.Name));
        }
コード例 #16
0
ファイル: ProductInfo.cs プロジェクト: friendlww/zhoulb
        private void ProductInfo_Load(object sender, EventArgs e)
        {
            if (_opearType == "修改")
            {
                var selectsql = SelectSQL.SelectProductWithId(_productId);
                var dt        = BindData.ReturnDataTable(selectsql);
                if (dt != null && dt.Rows.Count > 0)
                {
                    //绑定页面数据
                    txtProductName.Text = dt.Rows[0]["ProductName"].ToString();
                    txtProductCode.Text = dt.Rows[0]["ProductCode"].ToString();
                    txtInPrice.Text     = dt.Rows[0]["InPrice"].ToString();
                    txtOutPrice.Text    = dt.Rows[0]["OutPrice"].ToString();
                    txtProductNum.Text  = dt.Rows[0]["ProductNum"].ToString();
                    txtRemark.Text      = dt.Rows[0]["Remark"].ToString();
                    _clientId           = int.Parse(dt.Rows[0]["ClientInfo"].ToString());
                    _pictureId          = dt.Rows[0]["PictureInfo"].ToString();

                    //绑定客户数据
                    selectsql = SelectSQL.SelectClientWithId(_clientId);
                    dt        = BindData.ReturnDataTable(selectsql);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        lblClientName.Text  = dt.Rows[0]["ClientName"].ToString();
                        lblClientPhone.Text = dt.Rows[0]["ClientPhone"].ToString();
                    }

                    //绑定图片数据
                    selectsql = SelectSQL.SelectPictureWithId(_pictureId);
                    dt        = BindData.ReturnDataTable(selectsql);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        pictureBox1.SizeMode      = PictureBoxSizeMode.StretchImage;
                        pictureBox1.ImageLocation = dt.Rows[0]["PicturePath"].ToString();
                    }
                }
                button1.Text = "修改商品";
            }
        }