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); }
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); }
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 = "删除商品"; } }
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 = "图片"; } }
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()); } } }
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); }
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 = "修改"; } }
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); } }
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); } }
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; } }
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); } }
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); } }
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); } }
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); } }
/// <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)); }
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 = "修改商品"; } }