public int Insert_tbl_LoginHistory(string Person_Id) { DataSet ds = new DataSet(); int iResult = 0; using (SqlConnection cn = new SqlConnection(ConStr)) { if (cn.State == ConnectionState.Closed) { cn.Open(); } try { string sql = "set dateformat dmy; insert into tbl_LoginHistory (LoginHistory_PersonId, LoginHistory_LoggedInTime, LoginHistory_LoggedOutTime, LoginHistory_IPAddress, LoginHistory_MACAddress, LoginHistory_Status) values ('" + Person_Id + "', getdate(), null, '" + AllClasses.getIPAddress() + ", " + AllClasses.getIPAddress2() + "', '" + AllClasses.getMACAddress() + "', 1); select @@IDENTITY"; ds = ExecuteSelectQuery(sql); if (AllClasses.CheckDataSet(ds)) { iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); } else { iResult = 0; } } catch (Exception) { cn.Close(); iResult = -1; } } return(iResult); }
public string get_tbl_LoginHistory_Last_Login(string Person_Id) { DataSet ds = new DataSet(); string iResult = ""; using (SqlConnection cn = new SqlConnection(ConStr)) { if (cn.State == ConnectionState.Closed) { cn.Open(); } try { string sql = @"set dateformat dmy; with cte1 as ( select ROW_NUMBER() over(order by LoginHistory_Id desc) rr, * from tbl_LoginHistory where LoginHistory_PersonId = '" + Person_Id + "') select convert(varchar, LoginHistory_LoggedInTime, 9) LastLogin from cte1 where rr = 2"; ds = ExecuteSelectQuery(sql); if (AllClasses.CheckDataSet(ds)) { iResult = " (Your Last Login : "******"LastLogin"].ToString() + ") "; } else { iResult = " (Your Last Login : Never) "; } } catch (Exception) { cn.Close(); iResult = " (Your Last Login : Never) "; } } return(iResult); }
protected void grdPost_PreRender1(object sender, EventArgs e) { if (txtPersonName.Text.Trim() == "") { DataSet ds = new DataSet(); ds = new DataLayer().Insert_Grid2(txtPersonName.Text.Trim()); if (AllClasses.CheckDataSet(ds)) { grdPost.DataSource = ds; grdPost.DataBind(); } else { grdPost.DataSource = null; grdPost.DataBind(); } GridView gv = (GridView)sender; if (gv.Rows.Count > 0) { //This replaces <td> with <th> and adds the scope attribute gv.UseAccessibleHeader = true; } if ((gv.ShowHeader == true && gv.Rows.Count > 0) || (gv.ShowHeaderWhenEmpty == true)) { gv.HeaderRow.TableSection = TableRowSection.TableHeader; } if (gv.ShowFooter == true && gv.Rows.Count > 0) { gv.FooterRow.TableSection = TableRowSection.TableFooter; } } }
public bool Change_Password(string OldPassword, string NewPassword, int Person_Id) { string strQuery = ""; bool flag = false; DataSet ds = new DataSet(); using (SqlConnection cn = new SqlConnection(ConStr)) { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlTransaction trans = cn.BeginTransaction(); try { strQuery = " set dateformat dmy; select Login_Id from tbl_UserLogin where Login_PersonId='" + Person_Id + "' and Login_password='******' and Login_Status=1"; try { ds = ExecuteSelectQuery(strQuery); } catch { ds = null; } if (AllClasses.CheckDataSet(ds)) { strQuery = "update tbl_UserLogin set Login_password='******', Login_IsDefault = 1 where Login_PersonId='" + Person_Id + "' and Login_Status=1"; if (trans == null) { ExecuteSelectQuery(strQuery); } else { ExecuteSelectQuerywithTransaction(cn, strQuery, trans); } trans.Commit(); cn.Close(); flag = true; } } catch { trans.Rollback(); cn.Close(); flag = false; } } return(flag); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { int Album_Id = Convert.ToInt32(Request.QueryString[0].ToString()); string _inner = ""; DataSet ds = new DataLayer().get_Banner(Album_Id); if (AllClasses.CheckDataSet(ds)) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { _inner += "<a href = '" + ds.Tables[0].Rows[i]["AlbumUpload_Path"].ToString() + "' rel = 'lyteshow[vacation]' title = 'Preview-" + (i + 1) + "'>Preview-" + (i + 1) + "</a>"; } albumPreview.InnerHtml = _inner; } } }
private void get_Starring(string staring_type, ListBox ld) { DataSet ds = new DataSet(); ds = new DataLayer().get_Starring(staring_type); if (AllClasses.CheckDataSet(ds)) { ld.DataTextField = "Starring_name"; ld.DataValueField = "Starring_id"; ld.DataSource = ds.Tables[0]; ld.DataBind(); } else { ld.Items.Clear(); } }
private void get_Genere() { DataSet ds = new DataSet(); ds = new DataLayer().get_Genere(); if (AllClasses.CheckDataSet(ds)) { lbGenere.DataTextField = "Genere_Name"; lbGenere.DataValueField = "Genere_Id"; lbGenere.DataSource = ds.Tables[0]; lbGenere.DataBind(); } else { lbGenere.Items.Clear(); } }
public bool Insert_tbl_Category(tbl_Category obj_tbl_Category, int Category_Id, ref string Msg) { bool flag = false; DataSet ds = new DataSet(); using (SqlConnection cn = new SqlConnection(ConStr)) { if (cn.State == ConnectionState.Closed) { cn.Open(); } SqlTransaction trans = cn.BeginTransaction(); try { if (AllClasses.CheckDataSet(CheckDuplicacyCategory(obj_tbl_Category.Category_Name, Category_Id.ToString(), trans, cn))) { Msg = "A"; trans.Commit(); cn.Close(); return(false); } if (Category_Id == 0) { Insert_tbl_Category(obj_tbl_Category, trans, cn); } else { obj_tbl_Category.Category_Id = Category_Id; Update_tbl_Category(obj_tbl_Category, trans, cn); } trans.Commit(); cn.Close(); flag = true; } catch { trans.Rollback(); cn.Close(); flag = false; } } return(flag); }
protected void grdPost_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string Rating = e.Row.Cells[1].Text.Trim(); AjaxControlToolkit.Rating Rating1 = e.Row.FindControl("Rating1") as AjaxControlToolkit.Rating; Rating1.ReadOnly = true; Rating1.CurrentRating = Convert.ToInt32(Rating); BulletedList List_Director_id = (e.Row.FindControl("List_Director_id") as BulletedList); BulletedList List_Star_id = (e.Row.FindControl("List_Star_id") as BulletedList); BulletedList List_Supporting_id = (e.Row.FindControl("List_Suppoprting_id") as BulletedList); BulletedList List_Genere_id = (e.Row.FindControl("List_Genere_id") as BulletedList); generate_bullets(e.Row.Cells[2].Text.Trim(), List_Director_id); generate_bullets(e.Row.Cells[3].Text.Trim(), List_Star_id); generate_bullets(e.Row.Cells[4].Text.Trim(), List_Supporting_id); generate_bullets(e.Row.Cells[5].Text.Trim(), List_Genere_id); int Album_Id = Convert.ToInt32(e.Row.Cells[0].Text.ToString()); //HtmlGenericControl albumPreview = e.Row.FindControl("albumPreview") as HtmlGenericControl; HiddenField hf_albumPreview = e.Row.FindControl("hf_albumPreview") as HiddenField; string _inner = ""; DataSet ds = new DataLayer().get_Banner(Album_Id); if (AllClasses.CheckDataSet(ds)) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { _inner += "<a href = '" + ds.Tables[0].Rows[i]["AlbumUpload_Path"].ToString() + "' rel = 'lyteshow[vacation]' title = 'Preview-" + (i + 1) + "'>Preview-" + (i + 1) + "</a>"; } hf_albumPreview.Value = _inner; } } }
protected void btnSearch_Click(object sender, EventArgs e) { string Star = ""; string Director = ""; string Genere = ""; string Suppporting = ""; int Category_Id = 0; for (int i = 0; i < lbStarring.Items.Count; i++) { if (lbStarring.Items[i].Selected) { Star += lbStarring.Items[i].Value + ", "; } } if (Star.Trim() != "") { Star = Star.Trim().Substring(0, Star.Trim().Length - 1); } for (int i = 0; i < lbDirector.Items.Count; i++) { if (lbDirector.Items[i].Selected) { Director += lbDirector.Items[i].Value + ", "; } } if (Director.Trim() != "") { Director = Director.Trim().Substring(0, Director.Trim().Length - 1); } for (int i = 0; i < lbSupportingActor.Items.Count; i++) { if (lbSupportingActor.Items[i].Selected) { Suppporting += lbSupportingActor.Items[i].Value + ", "; } } if (Suppporting.Trim() != "") { Suppporting = Suppporting.Trim().Substring(0, Suppporting.Trim().Length - 1); } for (int i = 0; i < lbGenere.Items.Count; i++) { if (lbGenere.Items[i].Selected) { Genere += lbGenere.Items[i].Value + ", "; } } if (Genere.Trim() != "") { Genere = Genere.Trim().Substring(0, Genere.Trim().Length - 1); } int Studio_Id = 0; try { Studio_Id = Convert.ToInt32(ddlStudio.SelectedValue); } catch { Studio_Id = 0; } Category_Id = Convert.ToInt32(ddlCategory.SelectedValue); DataSet ds = new DataSet(); ds = new DataLayer().Insert_Grid(txtAlbumName.Text.Trim(), Category_Id, Studio_Id, Genere, Star, Suppporting, Director); if (AllClasses.CheckDataSet(ds)) { grdPost.DataSource = ds; grdPost.DataBind(); } else { grdPost.DataSource = null; grdPost.DataBind(); } }