Exemplo n.º 1
0
        public List <AccountParty> GetAccounts()
        {
            List <AccountParty> accounts = new List <AccountParty>();
            AccountParty        account  = null;

            DBSite site = new DBSite();

            string qry = " SELECT AccountMasterId, AccountName"
                         + " FROM  tblAccountMaster "
                         + " WHERE AccountName is not NULL AND UserId = " + Util_BLL.User.UserId
                         + "  ORDER BY AccountName";


            DataTable dt = site.ExecuteSelect(qry);

            foreach (DataRow row in dt.Rows)
            {
                account             = new AccountParty();
                account.AccountId   = util.CheckNullInt(row["AccountMasterId"]);
                account.AccountName = util.CheckNull(row["AccountName"]);

                accounts.Add(account);
            }

            return(accounts);
        }
Exemplo n.º 2
0
        public List <ExamMasterEntity> GetExamList(DBSite site, int userId, string id = "")
        {
            List <ExamMasterEntity> examList = new List <ExamMasterEntity>();

            string qry = "";

            qry += "SELECT "
                   + " ExamMasterId, ExamDate, ExamName, ExamCode, MaxMarks, PassMarks "
                   + ", TermId, ClassMasterID, SectionMasterID, ExamOrder, IsFormula, UserID, FYear "
                   + " FROM tblExamMaster em "

                   + " WHERE em.UserId = " + Util_BLL.User.UserId
                   + " AND isFormula = 0 ";

            if (id != string.Empty)
            {
                qry += "AND  ExamMasterId = " + id;
            }


            qry += " ORDER BY ExamOrder ";

            DataTable        dt = site.ExecuteSelect(qry);
            ExamMasterEntity exam;

            foreach (DataRow dr in dt.Rows)
            {
                exam = new ExamMasterEntity();


                exam.ExamMasterId = util.CheckNullInt(dr["ExamMasterId"]);
                exam.ExamDate     = util.CheckNullDate(dr["ExamDate"]);
                exam.ExamName     = util.CheckNull(dr["ExamName"]);
                exam.ExamCode     = util.CheckNull(dr["ExamCode"]);
                exam.TermId       = util.CheckNullInt(dr["TermId"]);

                exam.ClassMasterID = util.CheckNullInt(dr["ClassMasterID"]);

                exam.SectionMasterID = util.CheckNullInt(dr["SectionMasterID"]);
                exam.MaxMarks        = util.CheckNullInt(dr["MaxMarks"]);
                exam.PassMarks       = util.CheckNullInt(dr["PassMarks"]);
                exam.ExamOrder       = util.CheckNullInt(dr["ExamOrder"]);
                exam.IsFormula       = util.CheckNullInt(dr["IsFormula"]);

                exam.UserID = util.CheckNullInt(dr["UserID"]);
                exam.FYear  = util.CheckNullInt(dr["FYear"]);

                examList.Add(exam);
            }

            return(examList);
        }
Exemplo n.º 3
0
        public List <SMSMasterEntity> GetSMSsentList(string fromDt, string toDt)
        {
            List <SMSMasterEntity> smsList = new List <SMSMasterEntity>();


            if (fromDt == null)
            {
                fromDt = "1-Jan-17";
            }
            if (toDt == null)
            {
                toDt = DateTime.Today.ToString();
            }

            string qry = "";

            qry += "SELECT "
                   + " smsText, MobileNo, CreatedAt, MsgCount, UserID "
                   + " FROM tblSMSsent ss "
                   + " WHERE ss.UserId = " + Util_BLL.User.UserId
                   + " AND createdAt BETWEEN '" + fromDt + " ' AND '" + toDt + "'";
            qry += " ORDER BY createdAt ";

            DBSite site = new DBSite();

            DataTable       dt = site.ExecuteSelect(qry);
            SMSMasterEntity sms;

            foreach (DataRow dr in dt.Rows)
            {
                sms = new SMSMasterEntity();

                sms.SMSText  = util.CheckNull(dr["smsText"]);
                sms.MobileNo = util.CheckNull(dr["MobileNo"]);
                sms.SentDate = util.CheckNull(dr["CreatedAt"]);
                sms.SMSCount = util.CheckNullInt(dr["MsgCount"]);
                sms.UserId   = util.CheckNullInt(dr["UserID"]);

                smsList.Add(sms);
            }

            return(smsList);
        }
Exemplo n.º 4
0
        public List <SubjectGroupMasterEntity> GetSubjectGroup(DBSite site, int userId, string id = "")
        {
            List <SubjectGroupMasterEntity> groups = new List <SubjectGroupMasterEntity>();


            string qry = "";

            qry += "SELECT ";
            qry += " SubjectGroupMasterId, SubjectGroupName, SubjectGroupType, UserID, FYear ";
            qry += " FROM tblSubjectGroupMaster sgm ";

            qry += " WHERE sgm.UserId = " + Util_BLL.User.UserId;

            if (id != string.Empty)
            {
                qry += "AND  SubjectGroupMasterId = " + id;
            }


            qry += " ORDER BY SubjectGroupName ";

            DataTable dt = site.ExecuteSelect(qry);
            SubjectGroupMasterEntity sgrp;

            foreach (DataRow dr in dt.Rows)
            {
                sgrp = new SubjectGroupMasterEntity();

                sgrp.SubjectGroupMasterId = util.CheckNullInt(dr["SubjectGroupMasterId"].ToString());
                sgrp.SubjectGroupName     = util.CheckNull(dr["SubjectGroupName"]);
                sgrp.SubjectGroupType     = util.CheckNull(dr["SubjectGroupType"]);

                sgrp.UserID = util.CheckNullInt(dr["UserID"]);
                sgrp.FYear  = util.CheckNullInt(dr["FYear"]);

                groups.Add(sgrp);
            }

            return(groups);
        }
Exemplo n.º 5
0
        protected void gridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClearAll();
            edit_mode = true;
            site      = new DBSite();
            GridViewRow row = gridView1.SelectedRow;

            lblExamMasterId.Text = row.Cells[3].Text;

            SubjectMasterBLL sBll = new SubjectMasterBLL();

            ExamMasterBll exBll = new ExamMasterBll();

            ExamMasterBll.ExamMasterEntity exam = exBll.GetExamList(site, Util_BLL.User.UserId, lblExamMasterId.Text)[0];

            lblExamMasterId.Text = util.CheckNull(exam.ExamMasterId);
            txtExamName.Text     = exam.ExamName;
            txtExamCode.Text     = exam.ExamCode;
            ///txtExamDate.Text = exam.ExamDate;
            txtMaxMarks.Text  = util.CheckNull(exam.MaxMarks);
            txtPassMarks.Text = util.CheckNull(exam.PassMarks);

            ddlClass.SelectedValue   = util.CheckNull(exam.ClassMasterID);
            ddlSection.SelectedValue = util.CheckNull(exam.SectionMasterID);
            ddlTerm.SelectedValue    = util.CheckNull(exam.TermId);
        }
Exemplo n.º 6
0
        public List <StockTransactionType> GetInfo(DBSite site, string trn_id = "")
        {
            List <StockTransactionType> trn_list = new List <StockTransactionType>();
            StockTransactionType        trn      = null;

            string qry = " SELECT "
                         + "TransactionId "
                         + ", TransactionName "
                         + ", Flow"
                         + " FROM tblStockTransactionMaster"
                         + " WHERE "
                         + " UserId =" + Util_BLL.User.UserId
                         + " AND FYear=" + Util_BLL.User.fYear;

            if (trn_id != "")
            {
                qry += " AND TransactionId=" + trn_id;
            }

            DataTable dt = site.ExecuteSelect(qry);


            StoreBll store = new StoreBll();



            foreach (DataRow row in dt.Rows)
            {
                trn = new StockTransactionType();

                trn.StockTransactionId       = util.CheckNullInt(row["TransactionId"]);
                trn.StockTransactionName     = util.CheckNull(row["TransactionName"]);
                trn.StockTransactionFlow     = util.CheckNullInt(row["Flow"]);
                trn.StockTransactionFlowName = store.stock_transaction_type[trn.StockTransactionFlow];
                trn_list.Add(trn);
            }

            return(trn_list);
        }
Exemplo n.º 7
0
        // ------------  Get Tax Info -------------------------------------

        public List <TaxEntity> GetInfo(DBSite site, string tax_id = "")
        {
            List <TaxEntity> tax_list = new List <TaxEntity>();
            TaxEntity        tax      = null;

            string qry = " SELECT "
                         + "TaxId"
                         + ", TaxName"
                         + ", TaxPercent"
                         + ", TaxAmount"
                         + " FROM tblTaxMaster"
                         + " WHERE "
                         + " UserId =" + Util_BLL.User.UserId
                         + " AND FYear=" + Util_BLL.User.fYear;

            if (tax_id != "")
            {
                qry += " AND TaxId=" + tax_id;
            }

            DataTable dt = site.ExecuteSelect(qry);

            foreach (DataRow row in dt.Rows)
            {
                tax = new TaxEntity();

                tax.TaxId      = util.CheckNullInt(row["TaxId"]);
                tax.TaxName    = util.CheckNull(row["TaxName"]);
                tax.TaxPercent = util.CheckNullDecimal(row["TaxPercent"]);
                tax.TaxAmount  = util.CheckNullDecimal(row["TaxAmount"]);

                tax_list.Add(tax);
            }

            return(tax_list);
        }
Exemplo n.º 8
0
        public List <ClassMasterEntity> GetClassListBySubUser(DBSite site, int userId, string id, bool BySubUser)
        {
            List <ClassMasterEntity> classList = new List <ClassMasterEntity>();

            string qry = "";

            if (BySubUser)
            {
                qry = " SELECT  ClassMasterID, ClassName, ClassOrder, cl.UserID, cl.FYear  "
                      + " FROM tblClassMaster cl   "
                      + " INNER JOIN tblTeacherClasses tc ON tc.classId = cl.classMasterID  "
                      + " AND tc.userID = cl.userID AND tc.subuserID =" + Util_BLL.SubUser.SubuserId;
            }
            else
            {
                qry = " SELECT  ClassMasterID, ClassName, ClassOrder, UserID, FYear  "
                      + " FROM tblClassMaster cl  ";
            }

            qry += " WHERE cl.UserId = " + Util_BLL.User.UserId;

            if (id != string.Empty)
            {
                qry += "AND  ClassMasterID = " + id;
            }


            qry += " ORDER BY ClassOrder ";

            DataTable         dt = site.ExecuteSelect(qry);
            ClassMasterEntity cls;

            foreach (DataRow dr in dt.Rows)
            {
                cls = new ClassMasterEntity();

                cls.ClassMasterId = util.CheckNullInt(dr["ClassMasterID"].ToString());
                cls.ClassName     = util.CheckNull(dr["ClassName"]);
                cls.ClassOrder    = util.CheckNullInt(dr["ClassOrder"]);

                cls.UserID = util.CheckNullInt(dr["UserID"]);
                cls.FYear  = util.CheckNullInt(dr["FYear"]);

                classList.Add(cls);
            }

            return(classList);
        }
Exemplo n.º 9
0
        public String GetName(DBSite site, string selectedAccountType, string id)
        {
            string name = null;

            string qry = " SELECT " + GetColumnName(this, selectedAccountType);

            qry += " FROM " + GetTableName(this, selectedAccountType);
            qry += " WHERE " + GetTypeIdName(this, selectedAccountType) + " = " + id;

            DataTable dt = null;

            dt = site.ExecuteSelect(qry);
            DataRow dr = dt.Rows[0];

            name = util.CheckNull(dr[GetColumnName(this, selectedAccountType)]);

            return(name);
        }
Exemplo n.º 10
0
        public List <TermMasterEntity> GetTermList(DBSite site, int userId, string id = "")
        {
            List <TermMasterEntity> termList = new List <TermMasterEntity>();

            string qry = "";

            qry += "SELECT "
                   + " TermId, TermName, TermStartDate, TermEndDate, UserID, FYear "
                   + " FROM tblTerm tm "

                   + " WHERE tm.UserId = " + Util_BLL.User.UserId
                   + " ";

            if (id != string.Empty)
            {
                qry += "AND  TermId = " + id;
            }


            //qry += " ORDER BY TermStartDate ";

            DataTable        dt = site.ExecuteSelect(qry);
            TermMasterEntity term;

            foreach (DataRow dr in dt.Rows)
            {
                term = new TermMasterEntity();


                term.TermMasterId  = util.CheckNullInt(dr["TermId"]);
                term.TermName      = util.CheckNull(dr["TermName"]);
                term.TermStartDate = util.CheckNullDate(dr["TermStartDate"]);
                term.TermEndDate   = util.CheckNullDate(dr["TermEndDate"]);
                term.UserID        = util.CheckNullInt(dr["UserID"]);
                term.FYear         = util.CheckNullInt(dr["FYear"]);

                termList.Add(term);
            }

            return(termList);
        }
Exemplo n.º 11
0
        public List <SectionMasterEntity> GetSectionList(DBSite site, int userId, string id = "")
        {
            List <SectionMasterEntity> sectionList = new List <SectionMasterEntity>();

            string qry = "";

            qry += "SELECT ";
            qry += " SectionMasterID, SectionName, SectionOrder, UserID, FYear ";
            qry += " FROM tblSectionMaster sec ";

            qry += " WHERE sec.UserId = " + Util_BLL.User.UserId;

            if (id != string.Empty)
            {
                qry += "AND  SectionMasterID = " + id;
            }


            qry += " ORDER BY SectionOrder ";

            DataTable           dt = site.ExecuteSelect(qry);
            SectionMasterEntity sec;

            foreach (DataRow dr in dt.Rows)
            {
                sec = new SectionMasterEntity();

                sec.SectionMasterId = util.CheckNullInt(dr["SectionMasterID"].ToString());
                sec.SectionName     = util.CheckNull(dr["SectionName"]);
                sec.SectionOrder    = util.CheckNullInt(dr["SectionOrder"]);

                sec.UserID = util.CheckNullInt(dr["UserID"]);


                sec.FYear = util.CheckNullInt(dr["FYear"]);

                sectionList.Add(sec);
            }

            return(sectionList);
        }
Exemplo n.º 12
0
        protected void gridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClearAll();
            edit_mode = true;
            GridViewRow row = gridView1.SelectedRow;

            lblStudentMasterId.Text = row.Cells[3].Text;

            StudentBll sBll = new StudentBll();

            site = new DBSite();

            try
            {
                //StudentBll.StudenEntity st = sBll.GetStudents(site, util.CheckNullInt(lblStudentMasterId.Text))[0];
                StudentBll.StudenEntity st = sBll.GetStudents(site, lblStudentMasterId.Text)[0];

                txtStudentName.Text           = st.StudentName;
                txtAdmNo.Text                 = st.AdmNo;
                ddlPresentClass.SelectedValue = util.CheckNull(st.PresentClass);
                txtIdCardNo.Text              = st.IdCardNo;
                txtMotherName.Text            = st.MotherName;
                txtFatherName.Text            = st.FatherName;
                txtMobileNoF.Text             = st.MobileNoF;
                txtMobileNoM.Text             = st.MobileNoM;
                txtDOB.Text = st.DOB;
            }
            catch (Exception exception)
            {
                util.HandleExpception(exception, Response);
                // throw;
            }
            finally
            {
                site.Close();
            }
        }
Exemplo n.º 13
0
        protected string GetSelectedIds(GridView grd, int cellNo)
        {
            string selectedIds = "";

            foreach (GridViewRow gr in grd.Rows)
            {
                //string ckb_str = gr.Cells[0].FindControl("ckb").ClientID;
                //CheckBox cb = (CheckBox)gr.Cells[0].FindControl(ckb_str);

                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckb");


                if (cb != null && cb.Checked)
                {
                    selectedIds += ", " + util.CheckNull(gr.Cells[cellNo].Text);
                }
            }

            if (selectedIds.Length > 2)
            {
                selectedIds = selectedIds.Substring(2);
            }
            return(selectedIds);
        }
Exemplo n.º 14
0
        public static string[] GetProductIdAndUOM(DBSite site, string productId)
        {
            string qry = "SELECT SellingPrice , UnitName + ' | ' +CONVERT( VARCHAR, UOMId ) as UnitName"
                         + " FROM tblProductMaster as productTable "
                         + " LEFT OUTER  JOIN tblUOM  as unitTable ON productTable.UOM=unitTable.UOMId "
                         + /*util.GetUserWhereCondition()*/ " WHERE 1=1 AND productTable.UserID = " + Util_BLL.User.UserId + " AND productTable.FYear =  " + Util_BLL.User.fYear

                         + " AND ProductID='" + productId + "' ";

            DataTable dt = site.ExecuteSelect(qry);
            DataRow   dr = dt.Rows[0];

            return(new string[] { util.CheckNull(dr["UnitName"]), util.CheckNull(dr["SellingPrice"]) });
        }
Exemplo n.º 15
0
        public List <ReportCardCBSEEntity> GetReportCardCBSE(int studentId)
        {
            DBSite site = new DBSite();
            List <ReportCardCBSEEntity> ReportCardList = new List <ReportCardCBSEEntity>();

            DataTable dt = site.ExecuteSelect(GetCBSEQry_OakWood(studentId
                                                                 , "Scholastic"
                                                                 , "Unit Test 1"
                                                                 , "Unit Test 2"
                                                                 , "Unit Test 1"
                                                                 , "Unit Test 2"
                                                                 , "SEA 1"
                                                                 , "SEA 2"
                                                                 , "Half Yearly"
                                                                 , "Annual"
                                                                 , "Term I"
                                                                 , "Term II"
                                                                 ));
            ReportCardCBSEEntity reportCard;

            foreach (DataRow dr in dt.Rows)
            {
                reportCard = new ReportCardCBSEEntity();

                reportCard.StudentMasterId = studentId;
                reportCard.StudentName     = util.CheckNull(dr["StudentName"]);
                reportCard.DOB             = util.CheckNullDate(dr["dob"]);
                reportCard.Subject         = util.CheckNull(dr["SubjectName"]);
                reportCard.PerTest1        = util.CheckNull(dr["PerTest1"]);
                reportCard.NoteBook1       = util.CheckNull(dr["NoteBook1"]);
                reportCard.SEA1            = util.CheckNull(dr["SEA1"]);
                reportCard.HalfYearly      = util.CheckNull(dr["HalfYearly"]);
                reportCard.ClassName       = util.CheckNull(dr["ClassName"]);
                reportCard.SectionName     = util.CheckNull(dr["SectionName"]);
                reportCard.MotherName      = util.CheckNull(dr["MotherName"]);
                reportCard.FatherName      = util.CheckNull(dr["FatherName"]);
                reportCard.PerTest2        = util.CheckNull(dr["PerTest2"]);
                reportCard.NoteBook2       = util.CheckNull(dr["NoteBook2"]);
                reportCard.SEA2            = util.CheckNull(dr["SEA2"]);
                reportCard.Yearly          = util.CheckNull(dr["Yearly"]);



                ReportCardList.Add(reportCard);
            }
            return(ReportCardList);
        }
Exemplo n.º 16
0
        public List <AccountMasterEntity> GetAccountMasterData(DBSite site, int userId, string id = "")
        {
            List <AccountMasterEntity> accountMasterList = new List <AccountMasterEntity>();

            string qry = "";

            qry += "SELECT ";
            qry += "AccountMasterId, AccountName, CreationDate, OpeningBalance,";
            qry += "DRCR,  Address, City, Phone, Mobile, Email,";
            qry += " Remarks, acc.UserID, FYear ";

            qry += ", acc.GroupID  GroupID";
            qry += ", GroupName ";


            qry += " FROM tblAccountMaster as acc ";
            qry += " LEFT OUTER JOIN tblGroup as gp ON ";
            qry += " acc.GroupId = gp.GroupId ";


            //qry += Util_BLL.GetUserWhereCondition();
            qry += " Where acc.UserId = " + Util_BLL.User.UserId;

            if (id != string.Empty)
            {
                qry += "AND  AccountMasterId = " + id;
            }


            DataTable           dt = site.ExecuteSelect(qry);
            AccountMasterEntity ac;

            foreach (DataRow dr in dt.Rows)
            {
                ac = new AccountMasterEntity();

                ac.AccountMasterId = util.CheckNullInt(dr["AccountMasterId"].ToString());
                ac.AccountName     = dr["AccountName"].ToString();


                DateTime date = Convert.ToDateTime(dr["CreationDate"]);

                ac.CreationDate = date.ToShortDateString();

                ac.OpeningBalance = util.ToDecimal(util.CheckNullDecimal(dr["OpeningBalance"]));

                ac.DRCR      = util.CheckNullInt(dr["DRCR"]);
                ac.DRCR_Name = (util.CheckNullInt(dr["DRCR"]) == 0) ? "Credit" : "Debit";
                ac.Address   = util.CheckNull(dr["Address"].ToString());
                ac.City      = util.CheckNull(dr["City"].ToString());
                ac.Phone     = util.CheckNull(dr["Phone"].ToString());
                ac.Mobile    = util.CheckNull(dr["Mobile"].ToString());
                ac.Email     = util.CheckNull(dr["Email"].ToString());
                ac.Remarks   = util.CheckNull(dr["Remarks"].ToString());
                ac.GroupId   = util.CheckNullInt(dr["GroupId"]);
                ac.GroupName = util.CheckNull(dr["GroupName"]);
                ac.UserID    = util.CheckNullInt(dr["UserID"]);
                ac.FYear     = util.CheckNullInt(dr["FYear"]);

                accountMasterList.Add(ac);
            }

            return(accountMasterList);
        }
Exemplo n.º 17
0
        protected void btnSendSMSToAbsentees_Click(object sender, EventArgs e)
        {
            Util_BLL      util = new Util_BLL();
            AttendanceBll abll = new AttendanceBll();

            site = new DBSite();
            List <AttendanceBll.AttendanceEntity> attdList = new List <AttendanceBll.AttendanceEntity>();

            AttendanceBll.AttendanceEntity atd;

            foreach (GridViewRow gr in gridView1.Rows)
            {
                atd = new AttendanceBll.AttendanceEntity();



                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (!cb.Checked)
                {
                    atd.AttendanceId = util.CheckNullInt(gr.Cells[2].Text);

                    string msg = "Dear Parent, Your Child Name <40> is absent today.";
                    msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));

                    // 5cs School, Lalpur
                    if (Util_BLL.User.SenderId == "FifthC")
                    {
                        msg = "Dear Parents, Your ward '<40>' is absent today from School.";
                        msg = msg.Replace("<40>", util.CheckNull(gr.Cells[3].Text));
                    }


                    // if not class is Staff then do not send sms
                    // and not sms has been sent already

                    string mobileNo = abll.GetMobileNo(site, atd.AttendanceId);

                    string ss = util.SendSms(site, mobileNo, msg, Util_BLL.User, this.Response, false);

                    int sms_count = 0;

                    try
                    {
                        site.BeginTrans();

                        sms_count = util.SaveSentSMSToDB(site, mobileNo, msg, false, Util_BLL.User);
                        site.Commit();
                    }
                    catch (Exception ex)
                    {
                        site.RollBack();
                    }



                    if (abll.GetClassName(site, atd.AttendanceId).ToUpper() != "STAFF" && !abll.IsSMSSent(site, atd.AttendanceId))
                    {
                        //string ss = util.SendSms(abll.GetMobileNo(site, atd.AttendanceId), msg, Util_BLL.User, this.Response);
                    }


                    attdList.Add(atd);
                }
            }

            abll.PostSMS(site, attdList);
        }
Exemplo n.º 18
0
        public List <User> GetUsers(DBSite site, string user_id = "")
        {
            List <User> user_list = new List <User>();
            User        user      = null;

            string qry = " SELECT "
                         + " UserInfoId"
                         + ", UserName"
                         + ", Email"
                         + ", SenderId"
                         + ", SMSUser"
                         + ", SMSPassword"
                         + ", SMSDelivery"
                         + ", UserPassword"
                         + ", CreationDate"
                         + ", AmountPaid"
                         + ", StartDate"
                         + ", EndDate"
                         + ", Address"
                         + ", City"
                         + ", Country"
                         + ", Phone"
                         + ", Mobile"
                         + ", TinNumber"
                         + ", SalesTaxNumber"
                         + ", CSTNumber"
                         + ", UserType"
                         + ", IsUnicode"
                         + ", NumberOfSubusers"
                         + ", SMSUser"
                         + ", SMSPassword"
                         + ", SMSDelivery"
                         + ", Remarks";

            qry += " FROM tblUserInfo";

            if (user_id != "")
            {
                qry += " WHERE UserInfoId=" + user_id;
            }

            DataTable dt = site.ExecuteSelect(qry);

            foreach (DataRow row in dt.Rows)
            {
                user = new User();

                user.UserId         = util.CheckNullInt(row["UserInfoId"]);
                user.UserName       = util.CheckNull(row["UserName"]);
                user.EmailId        = util.CheckNull(row["Email"]);
                user.SenderId       = util.CheckNull(row["SenderId"]);
                user.SMSUser        = util.CheckNull(row["SMSUser"]);
                user.SMSPassword    = util.CheckNull(row["SMSPassword"]);
                user.SMSDelivery    = util.CheckNullInt(row["SMSDelivery"]);
                user.UserPassword   = util.CheckNull(row["UserPassword"]);
                user.AmountPaid     = util.CheckNullDecimal(row["AmountPaid"]);
                user.CreationDate   = ((DateTime)row["CreationDate"]).ToShortDateString();
                user.StartDate      = ((DateTime)row["StartDate"]).ToShortDateString();
                user.EndDate        = ((DateTime)row["EndDate"]).ToShortDateString();
                user.Address        = util.CheckNull(row["Address"]);
                user.City           = util.CheckNull(row["City"]);
                user.Country        = util.CheckNull(row["Country"]);
                user.Phone          = util.CheckNull(row["Phone"]);
                user.Mobile         = util.CheckNull(row["Mobile"]);
                user.TinNumber      = util.CheckNull(row["TinNumber"]);
                user.SalesTaxNumber = util.CheckNull(row["SalesTaxNumber"]);
                //user.SalesTaxNumber = System.Web.HttpContext.Current.Server.MapPath("\\image\\logo.bmp");
                // user.SalesTaxNumber = "http://www.gsc99.com/images/logo/bpslogo.jpg";

                user.CSTNumber        = util.CheckNull(row["CSTNumber"]);
                user.UserType         = util.CheckNullInt(row["UserType"]);
                user.IsUnicode        = util.CheckNullInt(row["IsUnicode"]) == 1 ? true : false;
                user.Remarks          = util.CheckNull(row["Remarks"]);
                user.NumberOFSubusers = util.CheckNullInt(row["NumberOfSubusers"]);
                user.fYear            = util.CheckNullInt(util.GetHomeSetting(site, "CurrentFYear"));

                user.Subusers    = GetSubusers(site, user.UserId + "");    //------  get subuser list --------
                user.Permissions = GetPermissions(site, user.UserId + ""); //-----  get permission list --------

                user_list.Add(user);
            }
            return(user_list);
        }
Exemplo n.º 19
0
        public List <ProductDetail> GetProductByDate(string fromDate, string toDate, int ProductId, int StockTransactionId)
        {
            DBSite site = new DBSite();
            List <ProductDetail> product_detail_list = new List <ProductDetail>();

            if (fromDate == null)
            {
                fromDate = "2013/09/01";
            }
            if (toDate == null)
            {
                toDate = "2014/09/01";
            }


            DateTime fDt = DateTime.Parse(fromDate);
            DateTime tDt = DateTime.Parse(toDate);

            DataTable dt = site.Execute_sp_productLedger(ProductId, StockTransactionId, -1, fDt, tDt, Util_BLL.User.UserId, 2012);

            DataRow row = null;

            ProductDetail product;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                product = new ProductDetail();

                row = dt.Rows[i];

                product.ProductLedgerId = util.CheckNullInt(row["ProductLedgerNumber"]);
                product.ProductId       = util.CheckNullInt(row["ProductId"]);
                product.ProductName     = row["ProductName"].ToString();


                product.LocationName = util.CheckNull(row["Location"]);


                product.AccountName = util.CheckNull(row["AccountName"]);

                product.sold_qty   = util.CheckNullDouble(row["credit"]);
                product.bought_qty = util.CheckNullDouble(row["debit"]);

                product.openingBalance = util.CheckNullDouble(row["openingBalance"]);
                product.closingBalance = util.CheckNullDouble(row["runningBalance"]);


                //666

                DateTime date = Convert.ToDateTime(row["BillDate"]);
                product.MovementDate      = date.ToShortDateString();
                product.TransactionTypeId = util.CheckNullInt(row["SourceId"]);
                product.TransactionName   = util.CheckNull(row["TransactionName"]);
                product.Narration         = util.CheckNull(row["Particulars"]);


                product_detail_list.Add(product);
            }


            return(product_detail_list);
        }
Exemplo n.º 20
0
        public List <ReportCardCBSEEntity_Hashmi> GetReportCardCBSE_Hashmi(int studentId)
        {
            DBSite site = new DBSite();
            List <ReportCardCBSEEntity_Hashmi> ReportCardList = new List <ReportCardCBSEEntity_Hashmi>();

            string qry = GetCBSEQry_Hashmi(studentId
                                           , "Scholastic"
                                           , "Unit Test 1"
                                           , "Unit Test 2"
                                           , "SA 1"
                                           , "SA 2"
                                           , "SEA 1"
                                           , "SEA 2"
                                           , "Half Yearly"
                                           , "Annual"
                                           , "Term 1"
                                           , "Term 2"
                                           );

            DataTable dt = site.ExecuteSelect(qry);
            ReportCardCBSEEntity_Hashmi reportCard;

            foreach (DataRow dr in dt.Rows)
            {
                reportCard = new ReportCardCBSEEntity_Hashmi();

                reportCard.StudentMasterId = studentId;
                reportCard.StudentName     = util.CheckNull(dr["StudentName"]);
                reportCard.Subject         = util.CheckNull(dr["SubjectName"]);

                reportCard.ClassName   = util.CheckNull(dr["ClassName"]);
                reportCard.SectionName = util.CheckNull(dr["SectionName"]);
                reportCard.MotherName  = util.CheckNull(dr["MotherName"]);
                reportCard.FatherName  = util.CheckNull(dr["FatherName"]);
                reportCard.DOB         = util.CheckNull(dr["dob"]);

                reportCard.UnitTest1         = util.CheckNull(dr["PerTest1"]);
                reportCard.UnitTest1MaxMarks = util.CheckNull(dr["UnitTest1MaxMarks"]);

                reportCard.SA1         = util.CheckNull(dr["NoteBook1"]);
                reportCard.SA1MaxMarks = util.CheckNull(dr["SA1MaxMarks"]);


                reportCard.UnitTest2         = util.CheckNull(dr["PerTest2"]);
                reportCard.UnitTest2MaxMarks = util.CheckNull(dr["UnitTest2MaxMarks"]);

                reportCard.SA2         = util.CheckNull(dr["NoteBook2"]);
                reportCard.SA2MaxMarks = util.CheckNull(dr["SA2MaxMarks"]);


                ReportCardList.Add(reportCard);
            }
            return(ReportCardList);
        }
Exemplo n.º 21
0
        public List <AttendanceByMonthEntity> GetAttendanceByMonth(int yearNo, int monthNo, int SchoolClassId)
        {
            List <AttendanceByMonthEntity> attendance_list = new List <AttendanceByMonthEntity>();

            AttendanceByMonthEntity abm;


            string qry = "SELECT * FROM vwAttendanceByMonth "
                         + Util_BLL.GetUserWhereCondition(Util_BLL.User)
                         + " AND YearNo = " + yearNo
                         + " AND MonthNo = " + monthNo;

            if (SchoolClassId != -1)
            {
                qry += " AND ClassMasterId = " + SchoolClassId;
            }


            DBSite    site2 = new DBSite();
            DataTable dt    = site2.ExecuteSelect(qry);

            foreach (DataRow dr in dt.Rows)
            {
                abm             = new AttendanceByMonthEntity();
                abm.StudentId   = util.CheckNullInt(dr["StudentMasterID"]);
                abm.StudentName = util.CheckNull(dr["StudentName"]);
                abm.ClassId     = util.CheckNullInt(dr["ClassMasterId"]);
                abm.ClassName   = util.CheckNull(dr["ClassName"]);
                abm.YearNo      = util.CheckNullInt(dr["YearNo"]);
                abm.MonthNo     = util.CheckNullInt(dr["MonthNo"]);
                abm.Day1        = util.CheckNull(dr["Day1"]);
                abm.Day2        = util.CheckNull(dr["Day2"]);
                abm.Day3        = util.CheckNull(dr["Day3"]);
                abm.Day4        = util.CheckNull(dr["Day4"]);
                abm.Day5        = util.CheckNull(dr["Day5"]);
                abm.Day6        = util.CheckNull(dr["Day6"]);
                abm.Day7        = util.CheckNull(dr["Day7"]);
                abm.Day8        = util.CheckNull(dr["Day8"]);
                abm.Day9        = util.CheckNull(dr["Day9"]);
                abm.Day10       = util.CheckNull(dr["Day10"]);
                abm.Day11       = util.CheckNull(dr["Day11"]);
                abm.Day12       = util.CheckNull(dr["Day12"]);
                abm.Day13       = util.CheckNull(dr["Day13"]);
                abm.Day14       = util.CheckNull(dr["Day14"]);
                abm.Day15       = util.CheckNull(dr["Day15"]);
                abm.Day16       = util.CheckNull(dr["Day16"]);
                abm.Day17       = util.CheckNull(dr["Day17"]);
                abm.Day18       = util.CheckNull(dr["Day18"]);
                abm.Day19       = util.CheckNull(dr["Day19"]);
                abm.Day20       = util.CheckNull(dr["Day20"]);
                abm.Day21       = util.CheckNull(dr["Day21"]);
                abm.Day22       = util.CheckNull(dr["Day22"]);
                abm.Day23       = util.CheckNull(dr["Day23"]);
                abm.Day2        = util.CheckNull(dr["Day24"]);
                abm.Day25       = util.CheckNull(dr["Day25"]);
                abm.Day26       = util.CheckNull(dr["Day26"]);
                abm.Day27       = util.CheckNull(dr["Day27"]);
                abm.Day28       = util.CheckNull(dr["Day28"]);
                abm.Day29       = util.CheckNull(dr["Day29"]);
                abm.Day30       = util.CheckNull(dr["Day30"]);
                abm.Day31       = util.CheckNull(dr["Day31"]);



                attendance_list.Add(abm);
            }

            return(attendance_list);
        }
Exemplo n.º 22
0
        public List <ProductMasterEntity> GetProductMasterData(DBSite site, string id = "")
        {
            List <ProductMasterEntity> productMasterList = new List <ProductMasterEntity>();

            string qry = "";

            qry += " SELECT ";
            qry += " ProductMasterId, ProductID,  ProductName, OpeningBalance, ProductDate, CostPrice, SellingPrice ";
            qry += " , ReOrderQty , ProductDescription, product.UserID, FYear, product.CreatedAt ";

            qry += ", category.CategoryId CategoryId ";
            qry += ", CategoryName ";

            qry += ", uom.UOMId UOMId ";
            qry += ", product.LocationId LocationId ";
            qry += ", product.AccountId AccountId ";
            qry += ", UnitName  ";
            qry += " FROM ( tblProductMaster as product ";
            qry += " LEFT OUTER JOIN tblProductCategory as category ON ";
            qry += " product.CategoryId = category.CategoryId )";
            qry += " LEFT OUTER JOIN tblUOM as uom ON ";
            qry += " product.UOM= uom.UOMId ";


            qry += " WHERE product.UserID =  " + Util_BLL.User.UserId;
            if (id != string.Empty)
            {
                qry += " AND  ProductMasterId = " + id;
            }

            DataTable           dt = site.ExecuteSelect(qry);
            ProductMasterEntity pme;

            foreach (DataRow dr in dt.Rows)
            {
                pme = new ProductMasterEntity();


                pme.ProductMasterId = util.CheckNullInt(dr["ProductMasterId"]);
                pme.ProductId       = util.CheckNull(dr["ProductID"]);
                pme.ProductName     = util.CheckNull(dr["ProductName"]);
                pme.OpeningBalance  = util.ToDecimal(util.CheckNullDecimal(dr["OpeningBalance"]));

                DateTime date = Convert.ToDateTime(dr["ProductDate"]);

                pme.productDate = date;


                pme.CostPrice    = util.ToDecimal(util.CheckNullDecimal(dr["CostPrice"]));
                pme.SellingPrice = util.ToDecimal(util.CheckNullDecimal(dr["SellingPrice"]));

                pme.UOM          = util.CheckNullInt(dr["UOMId"]);
                pme.UOMName      = util.CheckNull(dr["UnitName"]);
                pme.CategoryID   = util.CheckNullInt(dr["CategoryID"]);
                pme.CategoryName = util.CheckNull(dr["CategoryName"]);

                pme.AccountId  = util.CheckNullInt(dr["AccountId"]);
                pme.LocationId = util.CheckNullInt(dr["LocationId"]);

                pme.ReOrderQty = util.CheckNullDecimal(dr["ReOrderQty"]);

                pme.ProductDescription = util.CheckNull(dr["ProductDescription"]);
                pme.UserID             = util.CheckNullInt(dr["UserID"]);
                pme.FYear = util.CheckNullInt(dr["FYear"]);

                productMasterList.Add(pme);
            }


            return(productMasterList);
        }
Exemplo n.º 23
0
        public List <SalaryEntity> GetSalaries(DBSite site, int salaryID = -1)
        {
            List <SalaryEntity> salList = new List <SalaryEntity>();


            string qry = "";

            qry += " SELECT SalaryID, sa.DesignationID, Designation,  YearNo, MonthNo, BasicSalary ";

            qry += " , conveyance,  EPF, ESI, EMI, StaffID, st.StudentName ";
            qry += " , sa.userID, sa.FYear ";

            qry += " FROM  tblSalary as sa "
                   + " LEFT OUTER JOIN tblStudentMaster st on st.StudentMasterID = sa.staffID "
                   + " LEFT OUTER JOIN tblDesignation d ON d.designationId = sa.designationId "

                   + " WHERE sa.UserID =  " + Util_BLL.User.UserId;


            if (salaryID != -1)
            {
                qry += " AND  SalaryID = " + salaryID;
            }
            else
            {
                qry += " AND SalaryId IN (SELECT MAX(SalaryID) FROM tblSalary GROUP BY StaffID) ";
            }

            DataTable dt = site.ExecuteSelect(qry);

            SalaryEntity sal;

            foreach (DataRow dr in dt.Rows)
            {
                sal = new SalaryEntity();

                sal.SalaryId      = util.CheckNullInt(dr["SalaryID"]);
                sal.StaffId       = util.CheckNullInt(dr["StaffId"]);
                sal.StaffName     = util.CheckNull(dr["StudentName"]);
                sal.DesignationId = util.CheckNullInt(dr["DesignationId"]);
                sal.Designation   = util.CheckNull(dr["Designation"]);

                sal.YearNo  = util.CheckNullInt(dr["YearNo"]);
                sal.MonthNo = util.CheckNullInt(dr["MonthNo"]);


                sal.BasicSalary = util.CheckNullDouble(dr["BasicSalary"]);
                sal.Conveyance  = util.CheckNullDouble(dr["Conveyance"]);
                sal.epf         = util.CheckNullDouble(dr["epf"]);
                sal.esi         = util.CheckNullDouble(dr["esi"]);
                sal.emi         = util.CheckNullDouble(dr["emi"]);

                sal.UserID = util.CheckNullInt(dr["UserID"]);
                sal.FYear  = util.CheckNullInt(dr["FYear"]);


                salList.Add(sal);
            }



            return(salList);
        }
Exemplo n.º 24
0
        public string CalculatePercentMarks(DataTable dtResult, string subject, decimal MaxMarks, decimal percentValue)
        {
            // 10 %, 40% , 50 %

            string result = "0.00";

            // to remove divide by zero error
            if (MaxMarks == 0)
            {
                MaxMarks = 1;
            }

            decimal totalMarks = 0;

            string exm;

            foreach (DataRow drResult2 in dtResult.Rows)
            {
                exm = util.CheckNull(drResult2["ExamName"]).ToUpper();

                if ((percentValue == 10 && (exm == "Unit Test I".ToUpper() ||
                                            exm == "Unit Test II".ToUpper() ||
                                            exm == "Unit Test III".ToUpper())) ||
                    (percentValue == 40 && exm == "Half Yearly".ToUpper()) ||
                    (percentValue == 50 && exm == "Final Exam".ToUpper())

                    )
                {
                    if (util.CheckNull(drResult2[subject]) != "-")
                    {
                        totalMarks += util.CheckNullDecimal(drResult2[subject]);
                    }
                    else
                    {
                        totalMarks += 0;
                    }
                }
            }
            result = util.CheckNullDecimal((((totalMarks / MaxMarks) * percentValue))).ToString();

            return(result);
        }
Exemplo n.º 25
0
        //--------------  savew subuser information -----------------

        public void SaveSubuserInfo(DBSite site, SubuserEntity subuser)
        {
            int user_state = subuser.UserState == "1" ? 1 : 0;

            string subuser_info_qry = "  INSERT INTO tblSubuser ("
                                      + "SubuserName"
                                      + ", SubuserCreationDate"
                                      + ", SubuserPassword"
                                      + ", EmailId"
                                      + ", Designation"
                                      + ", Address"
                                      + ", City"
                                      + ", Mobile"
                                      + ", Active"
                                      + ", UserId"
                                      + ")";

            subuser_info_qry += " VALUES ("
                                + "'" + subuser.SubuserName + "'"
                                + ", '" + subuser.CreationDate + "'"
                                + ", '" + subuser.Password + "'"
                                + ", '" + subuser.EmailId + "'"
                                + ", '" + subuser.Designation + "'"
                                + ", '" + subuser.Address + "'"
                                + ", '" + subuser.City + "'"
                                + ", '" + subuser.Mobile + "'"
                                + ", " + user_state
                                + ", " + Util_BLL.User.UserId //----  User ID in Currently Logged In ---------------
                                + " )";

            site.Execute(subuser_info_qry); //------------  Enter subuser information  ------------------



            subuser_info_qry = " SELECT SubuserId FROM tblSubuser"
                               + " WHERE EmailId='" + subuser.EmailId + "'"
                               + " AND UserId=" + Util_BLL.User.UserId;

            string subuser_id = util.CheckNull(site.ExecuteSelect(subuser_info_qry).Rows[0]["SubuserId"]); //--  subuserId query --------------


            foreach (Permission permission in subuser.Permissions)
            {
                subuser_info_qry = " INSERT INTO tblUserPermissions"
                                   + "("
                                   + "UserId"
                                   + ", SubuserId"
                                   + ", PermissionId"
                                   + ")"
                                   + " VALUES("
                                   + Util_BLL.User.UserId //------ user id of Current User --------
                                   + ", " + subuser_id
                                   + ", " + permission.PermissionId
                                   + ")";

                site.Execute(subuser_info_qry);
            }



            foreach (ClassMasterBLL.ClassMasterEntity clas in subuser.TeacherClasses)
            {
                subuser_info_qry = " INSERT INTO tblTeacherClasses"
                                   + "("
                                   + "UserId"
                                   + ", SubuserId"
                                   + ", ClassId"
                                   + ")"
                                   + " VALUES("
                                   + Util_BLL.User.UserId //------ user id of Current User --------
                                   + ", " + subuser_id
                                   + ", " + clas.ClassMasterId
                                   + ")";

                site.Execute(subuser_info_qry);
            }

            foreach (SubjectMasterBLL.SubjectMasterEntity sub in subuser.TeacherSubjects)
            {
                subuser_info_qry = " INSERT INTO tblTeacherSubjects"
                                   + "("
                                   + "UserId"
                                   + ", SubuserId"
                                   + ", SubjectId"
                                   + ")"
                                   + " VALUES("
                                   + Util_BLL.User.UserId
                                   + ", " + subuser_id
                                   + ", " + sub.SubjectMasterId
                                   + ")";

                site.Execute(subuser_info_qry);
            }
        }
Exemplo n.º 26
0
        // ----------------  Authenticate User ----------------------------------------------

        public UserBLL.User AuthenticateUser(DBSite site, string email_id, string password, string user_id = "", int subuserId = -1)
        {
            UserBLL.User user     = null;
            UserBLL      user_bll = new UserBLL();
            string       qry      = "SELECT "
                                    + " UserInfoId"
                                    + ", UserName"
                                    + ", Email"
                                    + ", SenderID"
                                    + ", SMSUser"
                                    + ", SMSPassword"
                                    + ", SMSDelivery"
                                    + ", UserPassword"
                                    + ", CreationDate"
                                    + ", AmountPaid"
                                    + ", StartDate"
                                    + ", EndDate"
                                    + ", Address"
                                    + ", City"
                                    + ", Country"
                                    + ", Phone"
                                    + ", Mobile"
                                    + ", TinNumber"
                                    + ", SalesTaxNumber"
                                    + ", CSTNumber"
                                    + ", IsActive"
                                    + ", UserType"
                                    + ", IsUnicode"
                                    + ", Remarks"
                                    + ", NumberOfSubusers"
                                    + "  FROM tblUserInfo";

            if (user_id == "")
            {
                qry += " WHERE Email='" + email_id + "'"
                       + " AND UserPassword='******'";
            }
            else
            {
                qry += " WHERE UserInfoId=" + user_id;
            }

            DataTable dt = site.ExecuteSelect(qry);

            if (dt.Rows.Count > 0)
            {
                DataRow row = dt.Rows[0];
                user = new UserBLL.User();

                user.UserId      = util.CheckNullInt(row["UserInfoID"]);
                user.UserName    = util.CheckNull(row["UserName"]);
                user.EmailId     = util.CheckNull(row["Email"]);
                user.SenderId    = util.CheckNull(row["SenderID"]);
                user.SMSUser     = util.CheckNull(row["SMSUser"]);
                user.SMSPassword = util.CheckNull(row["SMSPassword"]);
                user.SMSDelivery = util.CheckNullInt(row["SMSDelivery"]);

                user.UserPassword     = util.CheckNull(row["UserPassword"]);
                user.CreationDate     = Convert.ToDateTime(row["CreationDate"]).ToShortDateString();
                user.AmountPaid       = util.CheckNullDecimal(row["AmountPaid"]);
                user.StartDate        = Convert.ToDateTime(row["StartDate"]).ToShortDateString();
                user.EndDate          = Convert.ToDateTime(row["EndDate"]).ToShortDateString();
                user.Address          = util.CheckNull(row["Address"]);
                user.City             = util.CheckNull(row["City"]);
                user.Country          = util.CheckNull(row["Country"]);
                user.Phone            = util.CheckNull(row["Phone"]);
                user.Mobile           = util.CheckNull(row["Mobile"]);
                user.TinNumber        = util.CheckNull(row["TinNumber"]);
                user.SalesTaxNumber   = util.CheckNull(row["SalesTaxNumber"]);
                user.CSTNumber        = util.CheckNull(row["CSTNumber"]);
                user.IsActive         = util.CheckNull(row["IsActive"]);
                user.UserType         = util.CheckNullInt(row["UserType"]);
                user.IsUnicode        = util.CheckNullInt(row["IsUnicode"]) == 1 ? true : false;
                user.Remarks          = util.CheckNull(row["Remarks"]);
                user.NumberOFSubusers = util.CheckNullInt(row["NumberOfSubusers"]);
                user.fYear            = util.CheckNullInt(util.GetHomeSetting(site, "CurrentFYear"));

                user.Subusers          = user_bll.GetSubusers(site, user.UserId + "");    //-------  Subusers --------
                user.Current_subuserId = subuserId;
                user.Permissions       = user_bll.GetPermissions(site, user.UserId + ""); //---------  Permissions ------------------
            }

            return(user);
        }
Exemplo n.º 27
0
        public List <StudenEntity> GetStudentsByClass(DBSite site, string ids, string classIds = "")
        {
            List <StudenEntity> studentList = new List <StudenEntity>();

            string qry = "";

            qry += " SELECT ";
            qry += " StudentMasterId, StudentName, AdmissionNo "
                   + " ,  st.ClassId, ClassName "
                   + " ,  sc.SectionMasterID, SectionName "
                   + " , IDCardNo, FatherName, MotherName, MobileF, MobileM ";
            qry += " , DOB, Email,  st.UserID, st.FYear, st.CreatedAt ";

            qry += " FROM  tblStudentMaster as st "
                   + " LEFT OUTER JOIN tblClassMaster c on c.classMasterID = st.classID  and c.userid =  " + Util_BLL.User.UserId
                   + " LEFT OUTER JOIN tblSectionMaster sc on sc.SectionMasterID = st.SectionID  and  sc.userId =  " + Util_BLL.User.UserId;

            qry += " WHERE st.UserID =  " + Util_BLL.User.UserId;

            if (ids != "")
            {
                qry += " AND  StudentMasterId IN (" + ids + ")";
            }

            if (classIds != "" && classIds != "ALL")
            {
                qry += " AND  st.ClassId In (" + classIds + ")";
            }
            else if (ids == "" && classIds == "")
            {
                classIds = "-999";
                qry     += " AND  st.ClassId In (" + classIds + ")";
            }
            else if (classIds == "ALL")
            {
                qry += " ";
            }

            qry += " order by classOrder, StudentName ";

            DataTable    dt = site.ExecuteSelect(qry);
            StudenEntity st;

            foreach (DataRow dr in dt.Rows)
            {
                st = new StudenEntity();

                st.StudentMasterId = util.CheckNullInt(dr["StudentMasterId"]);
                st.StudentName     = util.CheckNull(dr["StudentName"]);
                st.AdmNo           = util.CheckNull(dr["AdmissionNo"]);

                st.PresentClass     = util.CheckNullInt(dr["ClassID"]);
                st.PresentClassName = util.CheckNull(dr["ClassName"]);

                st.SectionId = util.CheckNullInt(dr["SectionMasterID"]);
                st.Section   = util.CheckNull(dr["SectionName"]);

                st.IdCardNo   = util.CheckNull(dr["IdCardNo"]);
                st.FatherName = util.CheckNull(dr["FatherName"]);
                st.MotherName = util.CheckNull(dr["MotherName"]);
                st.MobileNoF  = util.CheckNull(dr["MobileF"]);
                st.MobileNoM  = util.CheckNull(dr["MobileM"]);
                st.Email      = util.CheckNull(dr["Email"]);
                st.DOB        = util.CheckNullDate(dr["DOB"]);



                //DateTime date = Convert.ToDateTime(dr["ProductDate"]);
                //pme.productDate = date;



                st.UserID = util.CheckNullInt(dr["UserID"]);
                st.FYear  = util.CheckNullInt(dr["FYear"]);


                studentList.Add(st);
            }


            return(studentList);
        }
Exemplo n.º 28
0
        protected void SaveExamMarks()
        {
            ExamMarksBll emBll = new ExamMarksBll();

            site = new DBSite();

            List <ExamMarksBll.ExamMarksEntity> marksList = new List <ExamMarksBll.ExamMarksEntity>();

            ExamMarksBll.ExamMarksEntity mark;

            decimal       MaxMarksByExam = 0;
            ExamMasterBll exbLL          = new ExamMasterBll();

            SubjectMasterBLL sBll = new SubjectMasterBLL();


            string subjectGrpType = "MARKS";


            if (!isUpdate)
            {
                MaxMarksByExam = exbLL.GetExamMaxMarks(site, ddlExam.SelectedValue);
                subjectGrpType = sBll.GetSubjectGroupType(site, ddlSubject.SelectedValue);
            }


            foreach (GridViewRow gr in gridView1.Rows)
            {
                mark = new ExamMarksBll.ExamMarksEntity();

                CheckBox cb = (CheckBox)gr.Cells[0].FindControl("ckbPresent");
                if (cb.Checked)
                {
                    mark.IsPresent = 1;
                }
                else
                {
                    mark.IsPresent = 0;
                }


                mark.StudentMasterId = util.CheckNullInt(gr.Cells[2].Text);
                TextBox txt = (TextBox)gr.Cells[9].FindControl("txtMarksObtained");

                mark.StudentName = util.CheckNull(gr.Cells[3].Text);

                // if new then check for subject type -grade or marks
                if (!isUpdate)
                {
                    if (subjectGrpType.ToUpper() == "MARKS")
                    {
                        if (!util.isDecimal(txt.Text))
                        {
                            lblError.Text    = " Marks Obtained By '" + mark.StudentName + "' is not valid decimal.";
                            lblError.Visible = true;
                            return;
                        }
                    }
                    else // grade
                    {
                        //if (util.isDecimal(txt.Text))
                        //{
                        //    lblError.Text = " Marks Obtained By '" + mark.StudentName + "' is not valid Grade.";
                        //    lblError.Visible = true;
                        //    return;
                        //}
                    }
                }
                else // update
                {
                    subjectGrpType = util.CheckNull(gr.Cells[11].Text);
                    if (subjectGrpType.ToUpper() == "MARKS")
                    {
                        if (!util.isDecimal(txt.Text))
                        {
                            lblError.Text    = " Marks Obtained By '" + mark.StudentName + "' is not valid decimal.";
                            lblError.Visible = true;
                            return;
                        }
                    }
                    else
                    {
                        //if (util.isDecimal(txt.Text))
                        //{
                        //    lblError.Text = " Marks Obtained By '" + mark.StudentName + "' is not valid Grade.";
                        //    lblError.Visible = true;
                        //    return;
                        //}
                    }
                }


                if (util.isDecimal(txt.Text))
                {
                    if (isUpdate)
                    {
                        MaxMarksByExam = util.CheckNullDecimal(gr.Cells[10].Text);
                    }

                    decimal marksObtained = util.CheckNullDecimal(txt.Text);
                    if (marksObtained <= MaxMarksByExam)
                    {
                        mark.MarksObtained = util.CheckNull(marksObtained);
                    }
                    else
                    {
                        lblError.Text    = " Marks Obtained By '" + mark.StudentName + "' Can Not Be More Than Max Marks ( " + MaxMarksByExam + " ) ";
                        lblError.Visible = true;
                        return;
                    }
                }
                else
                {
                    mark.MarksObtained = util.CheckNull(txt.Text);
                }


                mark.classId   = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["classId"]);
                mark.SectionId = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["SectionId"]);


                if (isUpdate)
                {
                    mark.SubjectId = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["SubjectId"]);
                    mark.ExamId    = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["ExamId"]);
                }
                else
                {
                    mark.SubjectId = util.CheckNullInt(ddlSubject.SelectedValue);
                    mark.ExamId    = util.CheckNullInt(ddlExam.SelectedValue);
                }

                mark.ExamMarksId = util.CheckNullInt(gridView1.DataKeys[gr.RowIndex].Values["ExamMarksId"]);

                mark.SubUserID = Util_BLL.SubUser.SubuserId;
                mark.UserID    = Util_BLL.User.UserId;
                mark.FYear     = Util_BLL.User.fYear;

                marksList.Add(mark);
            }


            emBll.SaveMarks(site, marksList, isUpdate, false);


            string msg = "  Successfully Added ! ";

            if (isUpdate)
            {
                msg = "  Successfully Updated ! ";
            }

            lblMessage.Text    = msg;
            lblMessage.Visible = true;
            ClearErrorMessage();
        }
Exemplo n.º 29
0
        public List <SubjectMasterEntity> GetSubjectsBySubUser(DBSite site, int userId, string id, bool BySubUser)
        {
            List <SubjectMasterEntity> subjects = new List <SubjectMasterEntity>();

            string qry = "";

            qry += "SELECT ";
            qry += " SubjectMasterId, SubjectName ";
            qry += " , SubjectOrder, SubjectCode";

            qry += ", sub.SubjectGroupMasterId ";
            qry += ", SubjectGroupName ";
            qry += ", SubjectGroupType ";

            qry += ", sub.SubjectClassId ";
            qry += ", ISNull(ClassName, 'All') ClassName ";

            qry += ", sub.SubjectSectionId ";
            qry += ", IsNull(SectionName, 'All') SectionName ";
            qry += " , sub.UserID, sub.FYear ";


            qry += " FROM tblSubjectMaster sub ";
            qry += " LEFT OUTER JOIN tblSubjectGroupMaster sgp ON ";
            qry += " sub.SubjectGroupMasterId = sgp.SubjectGroupMasterId ";
            qry += " LEFT OUTER JOIN tblClassMaster cm ON ";
            qry += " cm.ClassMasterID = sub.SubjectClassId ";
            qry += " LEFT OUTER JOIN tblSectionMaster sm ON ";
            qry += " sm.SectionMasterId = sub.SubjectSectionID ";

            if (BySubUser)
            {
                qry += " INNER JOIN tblTeacherSubjects ts ON ts.SubjectId = sub.SubjectMasterID "
                       + "AND ts.UserId=sub.userID AND ts.SubUserId=" + Util_BLL.SubUser.SubuserId;
            }


            qry += " Where sub.UserId = " + Util_BLL.User.UserId;



            if (id != string.Empty)
            {
                qry += "AND  SubjectMasterId = " + id;
            }


            DataTable           dt = site.ExecuteSelect(qry);
            SubjectMasterEntity sub;

            foreach (DataRow dr in dt.Rows)
            {
                sub = new SubjectMasterEntity();

                sub.SubjectMasterId = util.CheckNullInt(dr["SubjectMasterId"]);
                sub.SubjectName     = util.CheckNull(dr["SubjectName"]);

                sub.SubjectGroupID   = util.CheckNullInt(dr["SubjectGroupMasterId"]);
                sub.SubjectGroupName = util.CheckNull(dr["SubjectGroupName"]);
                sub.SubjectGroupType = util.CheckNull(dr["SubjectGroupType"]);

                sub.SubjectClassID   = util.CheckNullInt(dr["SubjectClassId"]);
                sub.SubjectClassName = util.CheckNull(dr["ClassName"]);

                sub.SubjectSectionID   = util.CheckNullInt(dr["SubjectSectionID"]);
                sub.SubjectSectionName = util.CheckNull(dr["SectionName"]);

                sub.SubjectCode = util.CheckNull(dr["SubjectCode"]);

                sub.SubjectOrder = util.CheckNullInt(dr["SubjectOrder"]);

                sub.UserID = util.CheckNullInt(dr["UserID"]);
                sub.FYear  = util.CheckNullInt(dr["FYear"]);



                subjects.Add(sub);
            }


            return(subjects);
        }