protected void GridCompany_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { Button btn = (e.Row.FindControl("btnAdd") as Button); HiddenField HfId = (e.Row.FindControl("HfCOMP_CODE") as HiddenField); DataTable Dt = new DataTable(); string selectedUser = DdlUser.SelectedValue; Dt = COMPANYLogicLayer.GetCompanyDetailUserWiseRights(selectedUser); for (int i = 0; i < Dt.Rows.Count; i++) { if (HfId.Value == Dt.Rows[i]["COMP_CODE"].ToString()) { btn.Enabled = false; } } } } catch (Exception) { throw; } }
public void FillCompany() { try { DataTable Dt = COMPANYLogicLayer.GetCompanyDetailUserWiseRights(Session["USERCODE"].ToString()); DdlCompany.DataSource = Dt; DdlCompany.DataValueField = "COMP_CODE"; DdlCompany.DataTextField = "NAME"; DdlCompany.DataBind(); } catch (Exception) { throw; } }
private void GetCompanyOfSelectedUser() { try { DataTable Dt = new DataTable(); string selectedUser = DdlUser.SelectedValue; Dt = COMPANYLogicLayer.GetCompanyDetailUserWiseRights(selectedUser); GridCompany.DataSource = Dt; GridCompany.DataBind(); } catch (Exception) { throw; } }
private void GetComapnyByUser() { try { string selectedUser = DdlUser.SelectedValue; DataTable Dt = COMPANYLogicLayer.GetCompanyDetailUserWiseRights(selectedUser); DdlCompany.DataSource = Dt; DdlCompany.DataTextField = "NAME"; DdlCompany.DataValueField = "COMP_CODE"; DdlCompany.DataBind(); } catch (Exception) { throw; } }
protected void BtnCompanyLogin_Click(object sender, EventArgs e) { try { Session["USERCODE"] = Session["USERCODE"].ToString(); Session["USERNAME"] = Session["USERNAME"].ToString(); Session["USERTYPE"] = Session["USERTYPE"].ToString(); Session["COMP_CODE"] = DdlCompany.SelectedValue; Session["COMP_NAME"] = DdlCompany.SelectedItem.Text; //Session["WORK_VIEWFLAG"] DataTable DtWorkFlag = COMPANYLogicLayer.GetCompanyDetailUserWiseRights(Session["USERCODE"].ToString()); if (DtWorkFlag.Rows.Count > 0) { DataView DvFlag = new DataView(DtWorkFlag); DvFlag.RowFilter = "COMP_CODE='" + Session["COMP_CODE"].ToString() + "'"; DataTable Dtflag = DvFlag.ToTable(); if (Dtflag.Rows.Count > 0) { Session["WORK_VIEWFLAG"] = Dtflag.Rows[0]["WORK_VIEWFLAG"].ToString(); } else { Session["WORK_VIEWFLAG"] = null; } } Session["BRANCH_CODE"] = DdlBranch.SelectedValue; Session["BRANCH_NAME"] = DdlBranch.SelectedItem.Text; DataTable dt = BRANCH_MASLogicLayer.GetIDWiseBRANCH_MASDetialsByCompany(Session["COMP_CODE"].ToString(), Session["BRANCH_CODE"].ToString()); if (dt.Rows.Count > 0) { Session["BRANCH_TYPE"] = dt.Rows[0]["BRANCH_TYPE"].ToString(); } Session["FIN_YEAR"] = DdlFinYear.SelectedValue;//YRDT1 Session["MAC"] = GetMACAddress(); Session["PC"] = GetMachinName(); Session["INSERT"] = "Y"; Session["UPDATE"] = "Y"; Session["DELETE"] = "Y"; DataTable Dt = COMPANYLogicLayer.GetFIN_YEARSDetailUserWiseRightsAndCompanyWise(Session["USERCODE"].ToString(), Session["COMP_CODE"].ToString()); if (Dt.Rows.Count > 0) { DataView Dv = new DataView(Dt); Dv.RowFilter = "YRDT1='" + Session["FIN_YEAR"].ToString() + "'"; DataTable DtV = Dv.ToTable(); if (DtV.Rows.Count > 0) { Session["FIN_YEAR_END"] = DtV.Rows[0]["YRDT2"].ToString(); } else { Session["FIN_YEAR_END"] = null; } } else { Session["FIN_YEAR_END"] = null; } USERLOGINLogicLayer insert = new USERLOGINLogicLayer(); insert.LCL_ID = Session["PC"].ToString(); insert.MAC_ID = Session["MAC"].ToString(); insert.USERNAME = Session["USERNAME"].ToString(); string str = USERLOGINLogicLayer.InsertUSERLOGINDetials(insert); if (!str.Contains("successfully")) { //Response.Redirect("../Login.aspx"); } Response.Redirect("/Admin/Dashboard.aspx", false); } catch (Exception) { throw; } }