protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["Person_Id"].ToString() == "" || Session["Person_Id"].ToString() == null)
         {
             Response.Redirect("LoginForm.aspx", false);
         }
         int       Count = 0;
         DataTable dt    = CGeneralFunction.filldata("select count(*) from cdb..TRANSACTION_DETAILS where Attr1='1' and Forwarded_To='" + Session["Person_Id"].ToString() + "'");
         foreach (DataRow ro in dt.Rows)
         {
             Count = int.Parse(ro[0].ToString());
         }
         if (Count > 0)
         {
             //imgRequest.ImageUrl = "~/Icons/notifcation-message.png";
             //lblCount.Visible = true;
             //div1.Visible = true;
             //lblCount.Text = Count.ToString();
         }
         else
         {
             //imgRequest.ImageUrl = "~/Icons/notification-on.png";
             //lblCount.Visible = false;
             //div1.Visible = false;
         }
     }
     catch
     {
         Response.Redirect("LoginForm.aspx", false);
     }
 }
 private void populatebatchs()
 {
     if (!isalloweddatedate() && Session["RoleId"].ToString() != "9")
     {
         Response.Write("<script LANGUAGE='JavaScript' >alert('This facility is blocked by administration, Contact Admin!!.')</script>");
         return;
     }
     if (Session["RoleId"] != null)
     {
         DataTable dt = new DataTable();
         if (Session["RoleId"].ToString() == "1" || Session["RoleId"].ToString() == "9")
         {
             dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "') when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId   inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId where S.Attr2 ='A' and S.Status=1 and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'')  order by AttStatus");
         }
         else if (Session["RoleId"].ToString() == "7")
         {
             dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,CD.Cdd_Description as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "')  when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId   inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId inner join AdminExam ..tbl_Batch B on B.Batch_Id =C.Attr1 inner join AdminExam ..Course_def_Master CD on CD.Cdd_ID =B.Cdd_id  where  S.Attr2 ='A' and S.Status=1 and TeacherId='" + Session["EMPID"].ToString() + "' and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,''),CD.Cdd_Description order by AttStatus");
         }
         else if (Session["RoleId"].ToString() == "3" || Session["RoleId"].ToString() == "4" || Session["RoleId"].ToString() == "5" || Session["RoleId"].ToString() == "6")
         {
             dt = CGeneralFunction.filldataattendance("select ClassSectionId as class_id,c.Code as ClassName,Sc.code as DivisionName,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'') as ClassRoom,COUNT(*) as TotalStudent, case [dbo].[CheckAttendanceStatuswithdate](s.ClassSectionId,'" + txtDate.Text.Trim() + "') when 0 then '../Icons/Red.png' else '../Icons/Green.png' end as AttStatus from tblStudent as s inner join tblClassSection as cs on cs.Id=s.ClassSectionId   inner join tblClassMaster as c on c.Id=cs.ClassId inner join tblSection as sc on sc.Id=cs.SectionId inner join tblFaculty as f on f.Id=cs.TeacherId where cs.Id in (select ClassSectionId from tblDesignationAllocation where S.Attr2 ='A'  and S.Status=1 and FacultyId='" + Session["EMPID"].ToString() + "') and CS.Status =1 group by c.Code,Sc.code,ClassSectionId,Isnull(f.FirstName,'')+' '+Isnull(f.MiddleName,'')+' '+Isnull(f.LastName,'')  order by AttStatus");
         }
         if (dt.Rows.Count != 0)
         {
             gvStayBackReason.DataSource = dt;
         }
         else
         {
             gvStayBackReason.DataSource = null;
         }
         gvStayBackReason.DataBind();
         pnlMyClass.Visible = true;
     }
 }
Beispiel #3
0
    protected void ddlFaculty_SelectedIndexChanged(object sender, EventArgs e)
    {
        ddlClass.DataSource = CGeneralFunction.filldataattendance("select 0 as SN,0 as Id,'<Select>' as Description union all select Distinct 1 as SN,CS.Id ,CM.Description  from tblStudent S inner join tblClassSection CS on S.ClasssectionId = CS.Id inner join tblClassMaster CM on CS.ClassId =CM.Id where CS.Status =1 and S.Status = 1 and CS.TeacherId =" + ddlFaculty.SelectedValue + " and CS.AcademicYearId = " + ddlSem.SelectedValue);

        ddlClass.DataTextField  = "Description";
        ddlClass.DataValueField = "Id";
        ddlClass.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //if (Session["Person_Id"].ToString() == "" || Session["Person_Id"].ToString() == null)
            //    Response.Redirect("../Pages/LoginForm.aspx", false);
            //if (Session["Person_Id"].ToString() != "83")
            //{
            //    Response.Redirect("../Pages/LoginForm.aspx", false);
            //}
            int Count = 0;
            //DataTable dt = CGeneralFunction.filldata("select count(*) from cdb..TRANSACTION_DETAILS where Attr1='1' and Forwarded_To='" + Session["Person_Id"].ToString() + "'");
            //foreach (DataRow ro in dt.Rows)
            //{
            //    Count = int.Parse(ro[0].ToString());
            //}
            if (Count > 0)
            {
                //imgRequest.ImageUrl = "~/Icons/notifcation-message.png";
                //lblCount.Visible = true;
                //div1.Visible = true;
                //lblCount.Text = Count.ToString();
                LblNotification.Text = Count.ToString();
            }
            else
            {
                //imgRequest.ImageUrl = "~/Icons/notification-on.png";
                //lblCount.Visible = false;
                //div1.Visible = false;
            }

            // LblPageName.Text = Session["PageName"].ToString();
            StringBuilder str = new StringBuilder();
            DataTable     dtt = CGeneralFunction.filldata("exec SP_Menu");

            for (int i = 0; i <= dtt.Rows.Count - 1; i++)
            {
                str.Append(dtt.Rows[i][0].ToString());
            }



            ltrlMenu.Text = str.ToString();
        }



        catch (Exception Ex)
        {
            // throw Ex;
            Response.Redirect("../Pages/LoginForm.aspx", false);
        }
    }
Beispiel #5
0
        private void ToolStripMenuItemRegister_Click(object sender, EventArgs e)
        {
            FormRegister dlg    = new FormRegister();
            string       strMac = CGeneralFunction.GetMACaddressOne();

            SimpleScrypt SScrypt = new SimpleScrypt();

            dlg.CodeNO = SScrypt.Encrypt(strMac);
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                //实现注册代码,有待修改
                MessageBox.Show("程序必须重新启动!");
                CAppOption.RegKeyNO = dlg.KeyNO;
                CAppOption.SaveData();
                CAppOption.SaveKeyNO();

                Application.Exit();
            }
        }
    protected void gvStayBackReason_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (!isalloweddatedate() && Session["RoleId"].ToString() != "9")
        {
            Response.Write("<script LANGUAGE='JavaScript' >alert('This facility is blocked by administration, Contact Admin!!.')</script>");
            return;
        }
        try
        {
            if (e.CommandName == "View")
            {
                DataTable dt;
                string    csId = Convert.ToString(e.CommandArgument);
                dt = CGeneralFunction.filldata("Usp_BatchwiseStatus " + csId);
                if (dt.Rows.Count != 0)
                {
                    gridView.DataSource = dt;
                }
                else
                {
                    gridView.DataSource = null;
                }

                gridView.DataBind();
                ME1.Show();
            }
            else
            {
                int       ClassSectionId = Convert.ToInt32(e.CommandArgument.ToString());
                DataTable dt             = CGeneralFunction.filldataattendance("select ClassId,SectionId from tblClassSection where Id='" + ClassSectionId + "'");
                Session["Class_Id"]       = dt.Rows[0]["ClassId"].ToString();
                Session["Div_Id"]         = dt.Rows[0]["SectionId"].ToString();
                Session["ClassSectionId"] = ClassSectionId;
                Response.Redirect("Attendance.aspx?CId=" + ClassSectionId + "&&DDate=" + txtDate.Text.Trim(), false);
            }
        }
        catch
        {
        }
    }
Beispiel #7
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public static void LoadData()
        {
            string szOptionFile;

            szOptionFile = System.Windows.Forms.Application.StartupPath + "\\Option.dat";
            if (System.IO.File.Exists(szOptionFile))
            {
                System.Text.StringBuilder szValue = new System.Text.StringBuilder("", 256);

                int iRet;
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("App", "AppStyle", iAppStyle.ToString(), szValue, 256, szOptionFile);
                try
                {
                    iAppStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "Style", iFormStyle.ToString(), szValue, 256, szOptionFile);

                try
                {
                    iFormStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "SortStyle", iSortStyle.ToString(), szValue, 256, szOptionFile);

                try
                {
                    iSortStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "NumberFormat", NumberFormat, szValue, 256, szOptionFile);

                NumberFormat = szValue.ToString();
                if (NumberFormat == "")
                {
                    NumberFormat = "0.00";
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "MoneyFormat", MoneyFormat, szValue, 256, szOptionFile);

                MoneyFormat = szValue.ToString();
                if (MoneyFormat == "")
                {
                    MoneyFormat = "0.00";
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "PageRowCount", PageRowCount.ToString(), szValue, 256, szOptionFile);

                try
                {
                    PageRowCount = Convert.ToInt32(szValue.ToString());
                    if (PageRowCount < 10)
                    {
                        PageRowCount = 22;
                    }
                }
                catch
                {
                    PageRowCount = 22;
                }

                iRet      = PlatformInvokeKernel32.GetPrivateProfileString("App", "Idiograph", "", szValue, 256, szOptionFile);
                Idiograph = szValue.ToString();

                //注册码
                iRet         = PlatformInvokeKernel32.GetPrivateProfileString("Register", "Code", "", szValue, 256, szOptionFile);
                RegisterCode = szValue.ToString();

                iRet         = PlatformInvokeKernel32.GetPrivateProfileString("Register", "User", "", szValue, 256, szOptionFile);
                RegisterUser = szValue.ToString();

                string[] MacList = CGeneralFunction.GetMac();
                ChefMonitor.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("Mac:{0}", MacList[0]));

                if (MacList.Length > 0)
                {
                    SimpleScrypt SScrypt = new SimpleScrypt();
                    if (SScrypt.Encrypt(MacList[0]) == RegisterCode)
                    {
                        bRegister = true;
                    }
                    if (!string.IsNullOrEmpty(RegisterUser) && SScrypt.Encrypt(RegisterUser) == RegisterCode)
                    {
                        bRegister = true;
                    }
#if DEBUG
                    if (bRegister == false)
                    {
                        ChefMonitor.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("RegisterCode:{0}", SScrypt.Encrypt(MacList[0])));
                        ChefMonitor.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("RegisterCode:{0}", SScrypt.Encrypt(RegisterUser)));
                    }
#endif
                }
            }
            WindowStyleMan.LoadData();


            RegistryKey oRegSoft;
            oRegSoft = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
            if (oRegSoft == null)
            {
                //建立
                oRegSoft = Registry.LocalMachine.CreateSubKey("SOFTWARE");
            }

            RegistryKey oRegTemp = oRegSoft.OpenSubKey(Application.ProductName, true);
            if (oRegTemp == null)
            {
                oRegTemp = oRegSoft.CreateSubKey(Application.ProductName);
            }
            m_sUser = (string)oRegTemp.GetValue("User", "Admin");

            m_sPwd = ""; //20090110修改,不再
                         //m_sPwd=Decrypt((string)oRegTemp.GetValue("Pwd",""));

            m_sDbConnectString = CYyScrypt.Decrypt((string)oRegTemp.GetValue("DbConnect", CYyScrypt.Encrypt(m_sDbConnectString)));
            m_bSavePwd         = Convert.ToBoolean(oRegTemp.GetValue("SavePwd", true));
        }
Beispiel #8
0
        /// <summary>
        /// 加载数据
        /// </summary>
        public static void LoadData()
        {
            string szOptionFile;

            szOptionFile = System.Windows.Forms.Application.StartupPath + "\\Option.dat";
            if (System.IO.File.Exists(szOptionFile))
            {
                System.Text.StringBuilder szValue = new System.Text.StringBuilder("", 256);

                int iRet;
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("App", "AppStyle", iAppStyle.ToString(), szValue, 256, szOptionFile);
                try
                {
                    iAppStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "Style", iFormStyle.ToString(), szValue, 256, szOptionFile);

                try
                {
                    iFormStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "SortStyle", iSortStyle.ToString(), szValue, 256, szOptionFile);

                try
                {
                    iSortStyle = Convert.ToInt32(szValue.ToString());
                }
                catch
                {
                }
                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "NumberFormat", NumberFormat, szValue, 256, szOptionFile);

                NumberFormat = szValue.ToString();
                if (NumberFormat == "")
                {
                    NumberFormat = "0.00";
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "MoneyFormat", MoneyFormat, szValue, 256, szOptionFile);

                MoneyFormat = szValue.ToString();
                if (MoneyFormat == "")
                {
                    MoneyFormat = "0.00";
                }

                iRet = PlatformInvokeKernel32.GetPrivateProfileString("Windows", "PageRowCount", PageRowCount.ToString(), szValue, 256, szOptionFile);

                try
                {
                    PageRowCount = Convert.ToInt32(szValue.ToString());
                    if (PageRowCount < 10)
                    {
                        PageRowCount = 22;
                    }
                }
                catch
                {
                    PageRowCount = 22;
                }

                iRet      = PlatformInvokeKernel32.GetPrivateProfileString("App", "Idiograph", "", szValue, 256, szOptionFile);
                Idiograph = szValue.ToString();

                //注册码
                iRet         = PlatformInvokeKernel32.GetPrivateProfileString("Register", "Code", "", szValue, 256, szOptionFile);
                RegisterCode = szValue.ToString();

                iRet         = PlatformInvokeKernel32.GetPrivateProfileString("Register", "User", "", szValue, 256, szOptionFile);
                RegisterUser = szValue.ToString();

                string strMac = CGeneralFunction.GetMACaddressOne();
                Restaurant.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("Mac:{0}", strMac));

                if (strMac.Length > 0)
                {
                    SimpleScrypt SScrypt = new SimpleScrypt();
                    if (SScrypt.Encrypt(strMac) == RegisterCode)
                    {
                        bRegister = true;
                    }
                    if (!string.IsNullOrEmpty(RegisterUser) && SScrypt.Encrypt(RegisterUser) == RegisterCode)
                    {
                        bRegister = true;
                    }
#if DEBUG
                    if (bRegister == false)
                    {
                        Restaurant.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("RegisterCode:{0}", SScrypt.Encrypt(strMac)));
                        Restaurant.CGlobalInstance.Instance.FileLogger.WriteLog(YyLogger.LogSeverity.info, "配置加载", string.Format("RegisterCode:{0}", SScrypt.Encrypt(RegisterUser)));
                    }
#endif
                }
            }
            WindowStyleMan.LoadData();


            RegistryKey oRegSoft;
            oRegSoft = Registry.LocalMachine.OpenSubKey("SOFTWARE", true);
            if (oRegSoft == null)
            {
                //建立
                oRegSoft = Registry.LocalMachine.CreateSubKey("SOFTWARE");
            }

            RegistryKey oRegTemp = oRegSoft.OpenSubKey(Application.ProductName, true);
            if (oRegTemp == null)
            {
                oRegTemp = oRegSoft.CreateSubKey(Application.ProductName);
            }
            m_sUser = (string)oRegTemp.GetValue("User", "Admin");

            m_sPwd = ""; //20090110修改,不再
                         //m_sPwd=Decrypt((string)oRegTemp.GetValue("Pwd",""));

            //Jet的开发已经停止了,所以没有64位的版本。
            //Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\DB\Restaurant.mdb;Persist Security Info=False;Jet OLEDB:DataBase Password=legahero123
            //Provider=Microsoft.ACE.OLEDB.12.0;Data Source=d:\DB\Restaurant.accdb;Persist Security Info=False;Jet OLEDB:DataBase Password=legahero123
            string strAcc = "";//CYyScrypt.Encrypt(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Restaurant.mdb;Persist Security Info=False;Jet OLEDB:DataBase Password=legahero123");
            strAcc = "501D3F1847F9C54142AA6F0AF66D6F44C616C01EE400418CDAC8F89571A22E17D16E33A09E861EB9B253E258914D771FFDFDD75238B3085A49A885C62DFDF07D28F5DB62128B2D2D56D99B6571A27D9997C8EC446A5486366356281FBA2054D696DB7FA70E84BE91652FD7E333AA30A4DCEF7FE9D96538F2A43E3AA1777167209D4FE216F3A74373F152199CF089A987E707D7313E695522A798E4F5CAB316C1D1F72C51761BA18CA5BA726083D45D667DCA404A0CB8A5152BDCC50131A32A2BF554FCFF4FCE7AD9CC98DD954F54B177ED27D8D45E46078D704C8A83E3C4F0A8ED4E069B18936EB1998A7C72599628214665452AE7F5E217D98DD2674884";

#if TMPRELEASE
            //单机版
            m_sDbConnectString = CYyScrypt.Decrypt(strAcc);
#else
            m_sDbConnectString = CYyScrypt.Decrypt((string)oRegTemp.GetValue("DbConnect", CYyScrypt.Encrypt(m_sDbConnectString)));
#endif
            m_bSavePwd = Convert.ToBoolean(oRegTemp.GetValue("SavePwd", true));
        }