示例#1
0
        /// <summary>
        /// To Insert details of Student in tbl_Student_M table
        /// Created By : NafisaMulla, 2/7/2014
        /// Modified By :
        /// </summary>
        /// <param name="objStudentBO"></param>
        /// <returns></returns>
        public ApplicationResult Lock_Insert(LockBo objLockBo)
        {
            try
            {
                pSqlParameter = new SqlParameter[5];

                pSqlParameter[0]           = new SqlParameter("@TrustMID", SqlDbType.Int);
                pSqlParameter[0].Direction = ParameterDirection.Input;
                pSqlParameter[0].Value     = objLockBo.TrustMID;

                pSqlParameter[1]           = new SqlParameter("@SchoolMID", SqlDbType.Int);
                pSqlParameter[1].Direction = ParameterDirection.Input;
                pSqlParameter[1].Value     = objLockBo.SchoolMID;

                pSqlParameter[2]           = new SqlParameter("@FromDate", SqlDbType.VarChar);
                pSqlParameter[2].Direction = ParameterDirection.Input;
                pSqlParameter[2].Value     = objLockBo.FromDate;

                pSqlParameter[3]           = new SqlParameter("@ToDate", SqlDbType.VarChar);
                pSqlParameter[3].Direction = ParameterDirection.Input;
                pSqlParameter[3].Value     = objLockBo.ToDate;

                pSqlParameter[4]           = new SqlParameter("@LockYear", SqlDbType.Int);
                pSqlParameter[4].Direction = ParameterDirection.Input;
                pSqlParameter[4].Value     = objLockBo.LockYear;

                sSql = "tbl_Lock_M_Insert";

                DataTable dtResult = new DataTable();
                dtResult = Database.ExecuteDataTable(CommandType.StoredProcedure, sSql, pSqlParameter);
                ApplicationResult objResults = new ApplicationResult(dtResult);
                objResults.status = ApplicationResult.CommonStatusType.SUCCESS;
                return(objResults);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objLockBo = null;
            }
        }
示例#2
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            try
            {
                string strFromDate = txtFrom.Text;
                string strToDate = txtTo.Text;
                string LastTwoDigit, strYear;
                int    intNo;
                LastTwoDigit = strToDate.Substring(strToDate.Length - 2);
                intNo        = Convert.ToInt32(LastTwoDigit) - 1;
                strYear      = intNo.ToString() + LastTwoDigit;

                LockBL            objLockBl = new LockBL();
                LockBo            objLockBo = new LockBo();
                ApplicationResult objResult = new ApplicationResult();

                if (chkLock.Checked == true)
                {
                    objLockBo.TrustMID  = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                    objLockBo.SchoolMID = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]);
                    objLockBo.FromDate  = strFromDate;
                    objLockBo.ToDate    = strToDate;
                    objLockBo.LockYear  = Convert.ToInt32(strYear);

                    objResult = objLockBl.Lock_Insert(objLockBo);
                    if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                    }
                }
                else
                {
                    objResult = objLockBl.Lock_SelectbyYear(Convert.ToInt32(strYear));
                    if (objResult != null)
                    {
                        if (objResult.resultDT.Rows.Count > 0)
                        {
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('The Data of financial year " + strYear + " has been locked.');</script>");
                        }
                        else
                        {
                            EmployeeMBL       objEmployeeMBL    = new EmployeeMBL();
                            EmployeeMBO       objEmployeeMBO    = new EmployeeMBO();
                            ApplicationResult objResultValidate = new ApplicationResult();

                            objResultValidate = objEmployeeMBL.Employee_CheckForLoginAccount(txtUserName.Text, txtPassword.Text,
                                                                                             Convert.ToInt32(Session[ApplicationSession.TRUSTID]),
                                                                                             Convert.ToInt32(Session[ApplicationSession.SCHOOLID]));
                            if (objResultValidate != null)
                            {
                                DataTable dtResult = new DataTable();
                                dtResult = objResultValidate.resultDT;
                                if (dtResult.Rows.Count > 0)
                                {
                                    if (Convert.ToInt32(Session[ApplicationSession.USERID]) ==
                                        Convert.ToInt32(dtResult.Rows[0]["EmployeeMID"]))
                                    {
                                        Session[ApplicationSession.HASACCESSACCOUNTUSERID] =
                                            Convert.ToInt32(dtResult.Rows[0]["EmployeeMID"]);
                                        Session[ApplicationSession.ACCOUNTFROMDATE] = txtFrom.Text;
                                        Session[ApplicationSession.ACCOUNTTODATE]   = txtTo.Text;
                                        Session[ApplicationSession.FINANCIALYEAR]   = strYear;

                                        Response.Redirect(
                                            Convert.ToInt32(Session[ApplicationSession.SCHOOLID]) == 0
                                                ? "../Accounting/Home.aspx?mode=TU"
                                                : "../Accounting/Home.aspx", false);
                                    }
                                    else
                                    {
                                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                                           "<script>alert('Invalid username & password.');</script>");
                                    }
                                }
                                else
                                {
                                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp",
                                                                       "<script>alert('You do not have permission to access this module.');</script>");
                                }
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }