private void GetLoyaltyInfoFromDB(LoyaltyItem loyaltyItem) { SqlSelect sql = new SqlSelect("RETAILLOYALTYMSRCARDTABLE M " + "INNER JOIN RETAILLOYALTYCUSTTABLE C ON M.LOYALTYCUSTID = C.LOYALTYCUSTID " + "INNER JOIN RETAILLOYALTYSCHEMESTABLE S ON S.LOYALTYSCHEMEID = M.LOYALTYSCHEMEID "); sql.Select("M.LOYALTYSCHEMEID"); sql.Select("M.LOYALTYCUSTID"); sql.Select("ACCOUNTNUM"); sql.Select("EXPIRATIONTIMEUNIT"); sql.Select("EXPIRATIONTIMEVALUE"); sql.Where("M.DATAAREAID", Application.Settings.Database.DataAreaID, true); sql.Where("M.CARDNUMBER", loyaltyItem.LoyaltyCardNumber, true); // Sale Unit of Measure DataTable dataTable = new DBUtil(Application.Settings.Database.Connection).GetTable(sql); if (dataTable.Rows.Count > 0) { loyaltyItem.SchemeID = Utility.ToString(dataTable.Rows[0]["LOYALTYSCHEMEID"]); loyaltyItem.LoyaltyCustID = Utility.ToString(dataTable.Rows[0]["LOYALTYCUSTID"]); loyaltyItem.CustID = Utility.ToString(dataTable.Rows[0]["ACCOUNTNUM"]); loyaltyItem.ExpireUnit = Utility.ToInt(dataTable.Rows[0]["EXPIRATIONTIMEUNIT"]); loyaltyItem.ExpireValue = Utility.ToInt(dataTable.Rows[0]["EXPIRATIONTIMEVALUE"]); } }
public IEnumerable <ComputerDto> GetComputers(int takeFirst = 0) { var computers = new SqlSelect <Computer>() .First(takeFirst) .Run(this.DatabaseSession); return(computers.Select(ToComputerDto)); }
public IEnumerable <ComputerDto> SearchComputers(ComputerSearchRequest searchRequest) { var computers = new SqlSelect <Computer>() .AddCondition("Name", ComparisionOperator.Like, searchRequest.Name) .AddCondition("StaticIp", ComparisionOperator.Like, searchRequest.StaticIp, LogicalOperator.And) .Run(this.DatabaseSession); return(computers.Select(ToComputerDto)); }
protected void Button1_Click1(object sender, EventArgs e) { try { //ورود مسئولان دانشگاه if (RbEmployee.Checked) { int item = Query.Login("select count(karbar) from Users where karbar='" + TextBox2.Text + "' and pass="******" and type=1"); if (item != 0) { DataTable name = Query.Select("select bname,karbar from users where karbar='" + TextBox2.Text + "' and pass="******" and type=1"); Session["Login"] = name.Rows[0]["bname"].ToString(); Session["Karbar"] = name.Rows[0]["karbar"].ToString(); Session["Type"] = "1"; Response.Redirect("InsertNews_Page.aspx"); } else { Label1.Text = "نام کاربری یا کلمه عبور صحیح نیست"; } } //ورود دانشجویان if (RbStudent.Checked) { int item = Query.Login("select count(karbar) from Users where karbar='" + TextBox2.Text + "' and pass="******" and type=2"); if (item != 0) { DataTable name = Query.Select("select kname,karbar from users where karbar='" + TextBox2.Text + "' and pass="******" and type=2"); Session["Login"] = name.Rows[0]["kname"].ToString(); Session["Karbar"] = name.Rows[0]["karbar"].ToString(); Response.Redirect("Default.aspx"); } else { Label1.Text = "نام کاربری یا کلمه عبور صحیح نیست"; } } } catch (Exception er) { Label1.Text = er.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { //نمایش متن خبر در دیتالیست2 توسط کلاس سلکت (SqlSelect) try { DataList2.DataSource = Query.Select("select * from news where news# = " + Session["News_Code"] + ""); DataList2.DataMember = "Query"; DataList2.DataBind(); } catch (Exception) { } //نمایش متن نظرات در دیتالیست1 توسط کلاس سلکت (SqlSelect) try { DataList1.DataSource = Query.Select("select * from Comment inner join users on comment.karbar = users.karbar where news# = " + Session["News_Code"] + ""); DataList1.DataMember = "Query"; DataList1.DataBind(); } catch (Exception) { } }
private string GetComponent() { SqlSelect sqlSelect = new SqlSelect("TAXTABLE T1 left join TAXCOMPONENTTABLE_IN T2 on T1.TAXCOMPONENTTABLE_IN=T2.RECID"); sqlSelect.Select("ISNULL(T2.COMPONENT, '') as TAX_COMPONENT"); sqlSelect.Where("T1.TAXCODE", Code, true); DBUtil dbUtil = new DBUtil(ApplicationSettings.Database.LocalConnection); DataTable dt = dbUtil.GetTable(sqlSelect); return(dt.Rows.Count > 0 ? dt.Rows[0]["TAX_COMPONENT"].ToString() : String.Empty); }
private DataTable GetLoyaltyPointsSchemeFromDB(string schemeID) { try { SqlSelect sqlSelect = new SqlSelect("RETAILLOYALTYPOINTSTABLE"); sqlSelect.Select("*"); sqlSelect.Where("LOYALTYSCHEMEID", schemeID, true); sqlSelect.Where("DATAAREAID", Application.Settings.Database.DataAreaID, true); return(new DBUtil(Application.Settings.Database.Connection).GetTable(sqlSelect)); } catch (Exception ex) { NetTracer.Warning(ex, "Loyalty::GetLoyaltyPointsSchemeFromDB failed for schemeID {0}. Returning null.", schemeID); return(null); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { try { //جستجوی اخبار بر اساس متن خبر SqlSelect search = new SqlSelect(); DataTable result = search.Select("select * from news where txt like '%" + TextBox1.Text + "%'"); Label2.Visible = true; DataList1.DataSource = result; DataList1.DataMember = "Search"; DataList1.DataBind(); } catch (Exception er) { Label2.Visible = true; Label2.Text = er.ToString(); } }
private DataRow GetRetailGroupLineMember(Int64 recId) { try { SqlSelect sqlSelect = new SqlSelect("RETAILGROUPMEMBERLINE"); sqlSelect.Select("*"); sqlSelect.Where("RECID", recId, true); DataTable groupLineMember = new DBUtil(Application.Settings.Database.Connection).GetTable(sqlSelect); if (groupLineMember.Rows.Count == 1) { return(groupLineMember.Rows[0]); } else { return(null); } } catch (Exception ex) { NetTracer.Warning(ex, "Loyalty::GetRetailGroupLineMember failed for recId {0}. Returning null.", recId); return(null); } }