Example #1
0
        public void FillYear(string CompCode)
        {
            try
            {
                DataTable GetYear = COMPANYLogicLayer.GetAllFinancialYearDetials(CompCode);
                string    Year    = GetCurrentFinancialYear();
                if (GetYear.Rows.Count > 0)
                {
                    DataView DV = new DataView(GetYear);
                    DV.RowFilter = "YRDT1='" + Year + "-04-01 00:00:00.000'";

                    DataTable DT = DV.ToTable();

                    if (DT.Rows.Count == 0)
                    {
                        string Ans = COMPANYLogicLayer.InsertFinancialYearDetials(CompCode, Year + "-04-01 00:00:00.000", (Convert.ToInt32(Year) + 1).ToString() + "-03-31 00:00:00.000");
                    }
                }
                DataTable Dt = COMPANYLogicLayer.GetFIN_YEARSDetailUserWiseRightsAndCompanyWise(ViewState["USERCODE"].ToString(), CompCode);
                DdlFinYear.DataSource     = Dt;
                DdlFinYear.DataValueField = "YRDT1";
                DdlFinYear.DataTextField  = "YearString";
                DdlFinYear.DataBind();
            }
            catch (Exception)
            {
                throw;
            }
        }
 public void FillYear(string CompCode)
 {
     try
     {
         DataTable Dt = COMPANYLogicLayer.GetFIN_YEARSDetailUserWiseRightsAndCompanyWise(Session["USERCODE"].ToString(), CompCode);
         DdlFinYear.DataSource     = Dt;
         DdlFinYear.DataValueField = "YRDT1";
         DdlFinYear.DataTextField  = "YearString";
         DdlFinYear.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;
            }
        }