Exemplo n.º 1
0
        public void loadStaffDetails(Guid StaffId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Staff, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ChildData, "SubmitRecord", "Debug Submit Record Of MyAccountDetails", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.MyAccountService proxyMyAccount = new DayCareBAL.MyAccountService();

                if (Session["StaffId"] != null)
                {
                    StaffId = new Guid(Session["StaffId"].ToString());
                }
                DayCarePL.StaffProperties objstaff = proxyMyAccount.LoadMyAccountDetails(StaffId);
                if (objstaff != null)
                {
                    txtFirstName.Text = objstaff.FirstName;
                    txtLastName.Text  = objstaff.LastName;
                    txtUserName.Text  = objstaff.UserName;
                    //txtPassword.Text = objstaff.Password;
                    // txtOldPassword .Text= objstaff.Password;
                    //txtCode.Text = objstaff.Code;
                    hdnPassword.Value = objstaff.Password;
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Staff, "LoadMyAccountData", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
        }
        public static List <DayCarePL.StaffProperties> LoadStaffList(Guid SchoolYearId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.StaffList, "LoadStaffAttendanceHistoryList", "LoadStaffAttendanceHistoryList method called", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();
            List <DayCarePL.StaffProperties> lstStaffList = new List <DayCarePL.StaffProperties>();

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clFamilyPayment, "LoadStaffAttendanceHistoryList", "Debug LoadStaffAttendanceHistoryList called", DayCarePL.Common.GUID_DEFAULT);
                DayCarePL.StaffProperties objStaffList = null;
                var data = db.spGetStaffList(SchoolYearId);
                foreach (var s in data)
                {
                    objStaffList                   = new DayCarePL.StaffProperties();
                    objStaffList.FullName          = s.LastName + ", " + s.FirstName;
                    objStaffList.StaffSchoolYearId = s.StaffSchoolYearId;
                    objStaffList.Photo             = s.Photo;
                    objStaffList.Id                = s.Id;
                    lstStaffList.Add(objStaffList);
                }
                return(lstStaffList);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clChildProgEnrollment, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            DayCareBAL.StaffService proxyStaffService = new DayCareBAL.StaffService();
            Guid SchoolId = new Guid("8CA767A0-5E36-4343-8B1D-5ECC40EB9E1B");

            DayCarePL.StaffProperties objStaffDetails = proxyStaffService.LoadStaffDetailsByUserNameAndPassword("schooladmin", "schooladmin", SchoolId);
            GetChildProgEnrollmentFeeDetail(objStaffDetails.ScoolYearId);
        }
Exemplo n.º 4
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Staff, "btnSave_Click", "Submit btnSave_Click called", DayCarePL.Common.GUID_DEFAULT);

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Staff, "btnSave_Click", "Debug btnSave_Click ", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.MyAccountService proxyMyAccount = new DayCareBAL.MyAccountService();
                DayCareBAL.StaffService     proxystaff     = new DayCareBAL.StaffService();
                DayCarePL.StaffProperties   objStaff       = new DayCarePL.StaffProperties();

                objStaff.FirstName = txtFirstName.Text.Trim();
                objStaff.LastName  = txtLastName.Text.Trim();
                objStaff.UserName  = txtUserName.Text.Trim();
                objStaff.Password  = txtPassword.Text.Trim();

                if (Session["StaffId"] != null)
                {
                    objStaff.Id = new Guid(Session["StaffId"].ToString());
                }
                //Check Duplicate Code
                if (hdnPassword.Value == txtOldPassword.Text.Trim())
                {
                    // bool check = proxystaff.CheckDuplicateCode("", objStaff.Id, new Guid(Session["SchoolId"].ToString()));
                    bool check = false;
                    if (check == false)
                    {
                        proxyMyAccount.Save(objStaff);

                        txtFirstName.Text   = "";
                        txtLastName.Text    = "";
                        txtPassword.Text    = "";
                        txtNewPassword.Text = "";


                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", " Saved Successfully", "false"));
                    }
                    else
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", " Code Already Exist", "false"));
                    }
                }
                else
                {
                    MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Old Password Not Match", "false"));
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Staff, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
            }
        }
Exemplo n.º 5
0
        public static List <DayCarePL.StaffProperties> LoadStaffBySchoolProgramId(Guid SchoolProgramId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clProgClassRoom, "LoadStaffBySchoolProgramId", "Execute LoadStaffBySchoolProgramId Method", DayCarePL.Common.GUID_DEFAULT);
            SqlConnection conn = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["daycareConnectionString"].ToString());

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clProgClassRoom, "LoadStaffBySchoolProgramId", "Debug LoadStaffBySchoolProgramId Method", DayCarePL.Common.GUID_DEFAULT);
                List <DayCarePL.StaffProperties> lstProgClassRoom = new List <DayCarePL.StaffProperties>();
                DayCarePL.StaffProperties        objProgClassRoom;
                if (conn.State == System.Data.ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "spGetStaffBySchoolProgramId";
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Connection  = conn;
                cmd.Parameters.Add(new SqlParameter("@SchoolProgramId", SqlDbType.UniqueIdentifier)).Value = SchoolProgramId;

                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    objProgClassRoom          = new DayCarePL.StaffProperties();
                    objProgClassRoom.Id       = new Guid(dr["Id"].ToString());
                    objProgClassRoom.FullName = dr["FullName"].ToString();
                    lstProgClassRoom.Add(objProgClassRoom);
                }
                return(lstProgClassRoom);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clProgClassRoom, "LoadStaffBySchoolProgramId", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
            finally
            {
                if (conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
        protected void FillCoboofStaff()
        {
            DayCareBAL.StaffAttendanceHistoryListService proxystaff = new DayCareBAL.StaffAttendanceHistoryListService();
            DayCarePL.StaffProperties[]      result = proxystaff.LoadStaffList(new Guid(Session["CurrentSchoolYearId"].ToString())).ToArray();
            List <DayCarePL.StaffProperties> data   = new List <DayCarePL.StaffProperties>();

            DayCarePL.StaffProperties Rec = new DayCarePL.StaffProperties();
            Rec.Id       = new Guid("00000000-0000-0000-0000-000000000000");
            Rec.FullName = "--Select All--";
            foreach (DayCarePL.StaffProperties d in result)
            {
                data.Add(d);
            }
            data.Insert(0, Rec);
            rcbStudentList.Items.Clear();
            rcbStudentList.DataSource    = data;
            rcbStudentList.DataTextField = "FullName";
            rcbStudentList.DataBind();
            rcbStudentList.EmptyMessage = "---Select---";
        }
Exemplo n.º 7
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            DayCareBAL.StaffService proxyStaffService = new DayCareBAL.StaffService();
            //Guid SchoolId = new Guid("8CA767A0-5E36-4343-8B1D-5ECC40EB9E1B");
            //Guid SchoolId = new Guid("66E740A1-1202-45C9-9D4F-0493C8746EDD");
            Guid SchoolId = new Guid(ddlSchool.SelectedValue);

            DayCarePL.StaffProperties objStaffDetails = proxyStaffService.LoadStaffDetailsByUserNameAndPassword(txtLoginName.Text.Trim(), txtLoginPassword.Text.Trim(), SchoolId);
            if (objStaffDetails != null)
            {
                Session["StaffId"]             = objStaffDetails.Id;
                Session["StaffFullName"]       = objStaffDetails.FullName;
                Session["SchoolId"]            = objStaffDetails.SchoolId;
                Session["SchoolName"]          = objStaffDetails.SchoolName;
                Session["UserGroupTitle"]      = objStaffDetails.UserGroupTitle;
                Session["CurrentSchoolYearId"] = objStaffDetails.ScoolYearId;
                Session["Role_Id"]             = objStaffDetails.RolId;

                if (RememberMe.Checked)
                {
                    HttpCookie objCookiesUn = new HttpCookie("uid@DayCare", txtLoginName.Text.ToLower().Trim());
                    objCookiesUn.Expires = DateTime.Now.AddYears(100);
                    Response.Cookies.Add(objCookiesUn);
                }
                else
                {
                    if (Request.Cookies["uid@DayCare"] != null)
                    {
                        Response.Cookies["uid@DayCare"].Expires = DateTime.Now.AddYears(-100);
                    }
                }
                Response.Redirect("UI/DashBoard.aspx");
            }
            else
            {
                FailureText.Text = "UserName/Password is wrong please try again";
            }
        }
Exemplo n.º 8
0
 protected void rgStaffAttendanceList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
 {
     if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
     {
         DayCarePL.StaffProperties objStaff = e.Item.DataItem as DayCarePL.StaffProperties;
         Image imgStaff = e.Item.FindControl("imgStaff") as Image;
         if (!string.IsNullOrEmpty(objStaff.Photo))
         {
             imgStaff.ImageUrl = "../StaffImages/" + objStaff.Photo;
         }
         else
         {
             if (objStaff.Gender == true)//true= Male
             {
                 imgStaff.ImageUrl = "../StaffImages/male_photo.png";
             }
             else
             {
                 imgStaff.ImageUrl = "../StaffImages/female_photo.png";
             }
         }
     }
 }
Exemplo n.º 9
0
        public static bool Save(DayCarePL.StaffProperties objStaff)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clMyAccount, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            bool result           = false;
            DayCareDataContext db = new DayCareDataContext();
            Staff DBStaff         = null;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clMyAccount, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT);
                if (!objStaff.Id.Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    DBStaff = db.Staffs.SingleOrDefault(s => s.Id.Equals(objStaff.Id));
                }
                DBStaff.LastModifiedById     = objStaff.LastModifiedById;
                DBStaff.LastModifiedDatetime = DateTime.Now;
                DBStaff.FirstName            = objStaff.FirstName;
                DBStaff.LastName             = objStaff.LastName;
                DBStaff.UserName             = objStaff.UserName;
                DBStaff.Password             = objStaff.Password;
                DBStaff.code = objStaff.Code;
                if (objStaff.Id.Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    db.Staffs.InsertOnSubmit(DBStaff);
                }
                db.SubmitChanges();
                result = true;
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clMyAccount, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Exemplo n.º 10
0
 public bool Save(DayCarePL.StaffProperties objStaff)
 {
     return(DayCareDAL.clMyAccount.Save(objStaff));
 }
Exemplo n.º 11
0
 public Guid Save(DayCarePL.StaffProperties objStaff)
 {
     return(DayCareDAL.clStaff.Save(objStaff));
 }
Exemplo n.º 12
0
        protected void rgStaffList_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            //if (e.Item.ItemType == Telerik.Web.UI.GridItemType.AlternatingItem || e.Item.ItemType == Telerik.Web.UI.GridItemType.Item)
            //{
            //    GridDataItem dataItem = e.Item as GridDataItem;
            //    Label
            //}

            if (e.Item.ItemType == GridItemType.AlternatingItem || e.Item.ItemType == GridItemType.Item)
            {
                DayCarePL.StaffProperties objStaff = e.Item.DataItem as DayCarePL.StaffProperties;
                Image imgStaff = e.Item.FindControl("imgStaff") as Image;
                if (!string.IsNullOrEmpty(objStaff.Photo))
                {
                    imgStaff.ImageUrl = "../StaffImages/" + objStaff.Photo;
                }
                else
                {
                    if (objStaff.Gender == true)//true= Male
                    {
                        imgStaff.ImageUrl = "../StaffImages/male_photo.png";
                    }
                    else
                    {
                        imgStaff.ImageUrl = "../StaffImages/female_photo.png";
                    }
                }
                //Guid SchoolId = new Guid();
                //Guid CurrentSchoolYearId = new Guid();
                //if (Session["SchoolId"] != null)
                //{
                //    SchoolId = new Guid(Session["SchoolId"].ToString());
                //}

                //if (Session["CurrentSchoolYearId"] != null)
                //{
                //    CurrentSchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString());
                //}

                //if (!Common.IsCurrentYear(CurrentSchoolYearId, SchoolId))
                //{
                //    GridDataItem itm = (GridDataItem)e.Item;
                //    if (itm != null)
                //    {
                //        ImageButton imgbtnEdit = (ImageButton)itm["Edit"].Controls[0];
                //        if (imgbtnEdit != null)
                //        {
                //            imgbtnEdit.ToolTip = "";
                //            imgbtnEdit.Enabled = false;
                //            imgbtnEdit.Style.Value = "cursor:auto";
                //        }
                //        GridCommandItem cmdItem = itm.OwnerTableView.GetItems(GridItemType.CommandItem)[0] as GridCommandItem;
                //        if (cmdItem != null)
                //        {
                //            LinkButton lnkbtnInitInsertButton = (LinkButton)cmdItem.FindControl("InitInsertButton");
                //            lnkbtnInitInsertButton.Enabled = false;
                //            lnkbtnInitInsertButton.Style.Value = "cursor:auto";
                //        }
                //        //rgStaffList.MasterTableView.IsItemInserted = false;
                //    }
                //}
            }
        }
Exemplo n.º 13
0
        public static Guid Save(DayCarePL.StaffProperties objStaff)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clStaff, "Save", "Execute Save Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();

            DayCareDataContext db = new DayCareDataContext();

            System.Data.Common.DbTransaction tran = null;
            Staff DBStaff = null;
            Guid  StaffId;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clStaff, "Save", "Debug Save Method", DayCarePL.Common.GUID_DEFAULT);
                if (db.Connection.State == System.Data.ConnectionState.Closed)
                {
                    db.Connection.Open();
                }
                tran           = db.Connection.BeginTransaction();
                db.Transaction = tran;
                if (objStaff.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    DBStaff                 = new Staff();
                    DBStaff.Id              = System.Guid.NewGuid();
                    DBStaff.CreatedById     = objStaff.CreatedById;
                    DBStaff.CreatedDateTime = DateTime.Now;
                }
                else
                {
                    DBStaff = db.Staffs.SingleOrDefault(u => u.Id.Equals(objStaff.Id));
                }
                DBStaff.LastModifiedById     = objStaff.LastModifiedById;
                DBStaff.LastModifiedDatetime = DateTime.Now;
                DBStaff.UserGroupId          = objStaff.UserGroupId;
                DBStaff.StaffCategoryId      = objStaff.StaffCategoryId;
                DBStaff.FirstName            = objStaff.FirstName;
                DBStaff.LastName             = objStaff.LastName;
                DBStaff.Address1             = objStaff.Address1;
                DBStaff.Address2             = objStaff.Address2;
                DBStaff.City = objStaff.City;
                DBStaff.Zip  = objStaff.Zip;
                if (!objStaff.CountryId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    DBStaff.CountryId = objStaff.CountryId;
                }
                if (!objStaff.StateId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    DBStaff.StateId = objStaff.StateId;
                }
                DBStaff.MainPhone        = objStaff.MainPhone;
                DBStaff.SecondaryPhone   = objStaff.SecondaryPhone;
                DBStaff.Email            = objStaff.Email;
                DBStaff.UserName         = objStaff.UserName;
                DBStaff.Password         = objStaff.Password;
                DBStaff.code             = objStaff.Code;
                DBStaff.gender           = objStaff.Gender;
                DBStaff.SecurityQuestion = objStaff.SecurityQuestion;
                DBStaff.SecurityAnswer   = objStaff.SecurityAnswer;
                if (!string.IsNullOrEmpty(objStaff.Photo))
                {
                    DBStaff.Photo = DBStaff.Id + Path.GetExtension(objStaff.Photo);
                }
                else
                {
                    DBStaff.Photo = string.Empty;
                }
                //DBStaff.Active = objStaff.Active;
                DBStaff.Comments = objStaff.Comments;
                DBStaff.Message  = objStaff.Message;
                //DBStaff.IsPrimary = objStaff.IsPrimary;
                if (objStaff.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    db.Staffs.InsertOnSubmit(DBStaff);
                }
                db.SubmitChanges();

                if (!objStaff.Id.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    StaffSchoolYear DBStaffSchoolYear = db.StaffSchoolYears.SingleOrDefault(u => u.StaffId.Equals(objStaff.Id) && u.SchoolYearId.Equals(objStaff.ScoolYearId));
                    DBStaffSchoolYear.StaffId      = objStaff.Id;
                    DBStaffSchoolYear.SchoolYearId = objStaff.ScoolYearId;
                    DBStaffSchoolYear.active       = objStaff.Active;
                    db.SubmitChanges();
                }
                if (objStaff.Active == true)
                {
                    if (DayCareDAL.clStaffSchoolYear.ExportStafftoStaffSchoolYear(DBStaff.Id, objStaff.SchoolId, objStaff.ScoolYearId, objStaff.Active, tran, db))
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                    }
                }
                else
                {
                    tran.Commit();
                }
                StaffId = DBStaff.Id;
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clStaff, "Save", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                StaffId = new Guid();
                if (tran != null)
                {
                    tran.Rollback();
                }
            }
            finally
            {
                if (db.Connection.State == System.Data.ConnectionState.Open)
                {
                    db.Connection.Close();
                }
            }
            return(StaffId);
        }
Exemplo n.º 14
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Staff, "btnSave_Click", "Submit btnSave_Click called", DayCarePL.Common.GUID_DEFAULT);
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Role, "btnSave_Click", "Debug btnSave_Click ", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.StaffService   proxyStaffService = new DayCareBAL.StaffService();
                DayCarePL.StaffProperties objStaff          = new DayCarePL.StaffProperties();
                Guid StaffId;
                txtPassword.Attributes.Add("value", txtPassword.Text);
                txtCode.Attributes.Add("value", txtCode.Text);
                if (fupImage.HasFile)
                {
                    string   Extention = Path.GetExtension(fupImage.FileName).ToLower();
                    string[] Ext       = { ".jpeg", ".jpg", ".png" };
                    if (Ext.ToList().FindAll(et => et.Equals(Extention)).Count == 0)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select .JPEG,.PNG file!", "false"));
                        return;
                    }
                }
                if (ViewState["SelectedStaffId"] != null)
                {
                    objStaff.Id = new Guid(ViewState["SelectedStaffId"].ToString());
                }
                else
                {
                    if (Session["StaffId"] != null)
                    {
                        objStaff.CreatedById = new Guid(Session["StaffId"].ToString());
                    }
                }
                Guid SchoolId = new Guid();
                if (Session["StaffId"] != null)
                {
                    objStaff.LastModifiedById = new Guid(Session["StaffId"].ToString());
                }
                if (!string.IsNullOrEmpty(txtUserName.Text.Trim()))
                {
                    if (Session["SchoolId"] != null)
                    {
                        SchoolId             = new Guid(Session["SchoolId"].ToString());
                        objStaff.SchoolId    = SchoolId;
                        objStaff.ScoolYearId = CurrentSchoolYearId;
                    }
                    bool result = proxyStaffService.CheckDuplicateUserName(txtUserName.Text.Trim(), objStaff.Id, SchoolId);
                    if (result)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "User Name Already Exist", "false"));
                        return;
                    }
                }

                if (Session["SchoolId"] != null)
                {
                    SchoolId             = new Guid(Session["SchoolId"].ToString());
                    objStaff.SchoolId    = SchoolId;
                    objStaff.ScoolYearId = CurrentSchoolYearId;
                }
                bool IsCodeRequire = proxyStaffService.CheckCodeRequire(objStaff.SchoolId);
                if (IsCodeRequire)
                {
                    if (string.IsNullOrEmpty(txtCode.Text.Trim()))
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please enter Passcode", "false"));
                        txtCode.Focus();
                        return;
                    }
                }
                //bool result = proxyStaffService.CheckDuplicateCode(txtCode.Text.Trim(), objStaff.Id, SchoolId);
                //if (result)
                //{
                //    MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                //    MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Code Already Exist", "false"));
                //    return;
                //}


                objStaff.UserGroupId     = new Guid(ddlUserGroup.SelectedValue);
                objStaff.StaffCategoryId = new Guid(ddlStaffCategory.SelectedValue);
                objStaff.FirstName       = txtFirstName.Text.Trim();
                objStaff.LastName        = txtLastName.Text.Trim();
                objStaff.Address1        = txtAddress1.Text.Trim();
                objStaff.Address2        = txtAddress2.Text.Trim();
                objStaff.City            = txtCity.Text.Trim();
                objStaff.Zip             = txtZip.Text.Trim();
                objStaff.CountryId       = new Guid(ddlCountry.SelectedValue);
                objStaff.StateId         = new Guid(ddlState.SelectedValue);
                objStaff.MainPhone       = txtMainPhone.Text.Trim();
                objStaff.SecondaryPhone  = txtSecondaryPhone.Text.Trim();
                objStaff.Email           = txtEmail.Text.Trim();
                objStaff.UserName        = txtUserName.Text.Trim();
                objStaff.Password        = txtPassword.Text.Trim();

                objStaff.Code = txtCode.Text.Trim();
                //if (rdMale.Checked == true)
                //{
                //    objStaff.Gender = true;
                //}
                //else
                //{
                //    objStaff.Gender = false;
                //}
                if (ddlGender.SelectedValue == "true")
                {
                    objStaff.Gender = true;
                }
                else
                {
                    objStaff.Gender = false;
                }
                objStaff.SecurityQuestion = txtSecurityQuestion.Text.Trim();
                objStaff.SecurityAnswer   = txtSecurityAnswer.Text.Trim();
                if (fupImage.HasFile)
                {
                    objStaff.Photo = fupImage.FileName;
                }
                else
                {
                    objStaff.Photo = lblImage.Text;
                }
                if (rdActive.Checked == true)
                {
                    objStaff.Active = true;
                }
                else
                {
                    objStaff.Active = false;
                }
                objStaff.Comments = txtComment.Text.Trim();
                objStaff.Message  = txtMessage.Text;
                //objStaff.IsPrimary = chkIsPrimary.Checked;
                StaffId = proxyStaffService.Save(objStaff);
                if (!StaffId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                {
                    if (fupImage.HasFile)
                    {
                        #region "resize image"
                        // Create a bitmap of the content of the fileUpload control in memory
                        Bitmap originalBMP = new Bitmap(fupImage.FileContent);

                        // Calculate the new image dimensions
                        double origWidth  = originalBMP.Width;
                        double origHeight = originalBMP.Height;
                        double sngRatio   = origWidth / origHeight;
                        int    newWidth   = 200;
                        int    newHeight  = (int)(newWidth / sngRatio);
                        //int newHeight =0;
                        //if (sngRatio > 0)
                        //    newHeight = newWidth / sngRatio;
                        //else
                        //    newHeight = 200;

                        // Create a new bitmap which will hold the previous resized bitmap
                        Bitmap newBMP = new Bitmap(originalBMP, newWidth, newHeight);
                        // Create a graphic based on the new bitmap
                        Graphics oGraphics = Graphics.FromImage(newBMP);

                        // Set the properties for the new graphic file
                        oGraphics.SmoothingMode = SmoothingMode.AntiAlias; oGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                        // Draw the new graphic based on the resized bitmap
                        oGraphics.DrawImage(originalBMP, 0, 0, newWidth, newHeight);

                        // Save the new graphic file to the server
                        newBMP.Save(Server.MapPath("~/StaffImages/" + StaffId + Path.GetExtension(fupImage.FileName)));

                        // Once finished with the bitmap objects, we deallocate them.
                        originalBMP.Dispose();
                        newBMP.Dispose();
                        oGraphics.Dispose();
                        #endregion

                        //fupImage.SaveAs(Server.MapPath("~/StaffImages/" + StaffId + Path.GetExtension(fupImage.FileName)));
                    }

                    //MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    //MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                    Response.Redirect("StaffList.aspx", false);
                }
                else
                {
                    MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again.", "false"));
                    return;
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Staff, "btnSave_Click", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Internal Error,Please try again", "false"));
                return;
            }
        }
Exemplo n.º 15
0
 public void LoadStaffDetails(Guid StaffId, Guid CurrentSchoolyearId)
 {
     DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Staff, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
     try
     {
         DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Staff, "SubmitRecord", "Debug Submit Record Of Role", DayCarePL.Common.GUID_DEFAULT);
         DayCareBAL.StaffService   proxyStaffService = new DayCareBAL.StaffService();
         DayCarePL.StaffProperties objStaff          = proxyStaffService.LoadStaffBystaffId(StaffId, CurrentSchoolyearId);
         if (objStaff != null)
         {
             if (!string.IsNullOrEmpty(objStaff.Photo))
             {
                 imgStaff.ImageUrl = "../StaffImages/" + objStaff.Photo;
             }
             else
             {
                 if (objStaff.Gender == true)
                 {
                     imgStaff.ImageUrl = "../StaffImages/male_photo.png";
                 }
                 else
                 {
                     imgStaff.ImageUrl = "../StaffImages/female_photo.png";
                 }
             }
             ddlUserGroup.SelectedValue     = objStaff.UserGroupId.ToString();
             ddlStaffCategory.SelectedValue = objStaff.StaffCategoryId.ToString();
             txtFirstName.Text        = objStaff.FirstName;
             txtLastName.Text         = objStaff.LastName;
             txtAddress1.Text         = objStaff.Address1;
             txtAddress2.Text         = objStaff.Address2;
             txtCity.Text             = objStaff.City;
             txtZip.Text              = objStaff.Zip;
             ddlCountry.SelectedValue = objStaff.CountryId.ToString();
             if (!objStaff.CountryId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
             {
                 Common.BindStateDropDown(ddlState, objStaff.CountryId.ToString());
             }
             if (ddlState.Items != null && ddlState.Items.Count > 0)
             {
                 ddlState.SelectedValue = objStaff.StateId.ToString();
             }
             txtMainPhone.Text      = objStaff.MainPhone;
             txtSecondaryPhone.Text = objStaff.SecondaryPhone;
             txtEmail.Text          = objStaff.Email;
             txtUserName.Text       = objStaff.UserName;
             txtPassword.Text       = objStaff.Password;
             txtPassword.Attributes.Add("value", txtPassword.Text);
             txtCode.Text = objStaff.Code;
             txtCode.Attributes.Add("value", objStaff.Code);
             if (objStaff.Gender == true)
             {
                 ddlGender.SelectedValue = "true";
             }
             else
             {
                 ddlGender.SelectedValue = "false";
             }
             txtSecurityQuestion.Text = objStaff.SecurityQuestion;
             txtSecurityAnswer.Text   = objStaff.SecurityAnswer;
             if (objStaff.Active == true)
             {
                 rdActive.Checked = true;
             }
             else
             {
                 rdInactive.Checked = true;
             }
             txtComment.Text = objStaff.Comments;
             txtMessage.Text = objStaff.Message;
             //chkIsPrimary.Checked = objStaff.IsPrimary;
             lblImage.Text = objStaff.Photo;
         }
     }
     catch (Exception ex)
     {
         DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Staff, "LoadStaffDetails", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
     }
 }
Exemplo n.º 16
0
        public static DayCarePL.StaffProperties LoadStaffDetailsByUserNameAndPasswordForSchedule(string UserName, string Password, Guid SchoolId, string strConnectionString)
        {
            //DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clStaff, "LoadStaffDetailsByUserNameAndPassword", "Execute LoadStaffDetailsByUserNameAndPassword Method", DayCarePL.Common.GUID_DEFAULT);
            DayCareDAL.clSchedular.DoSchedularConnection(strConnectionString);
            DayCareDataContext db = new DayCareDataContext();

            DayCarePL.StaffProperties objStaff = null;
            try
            {
                //DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clStaff, "LoadStaffDetailsByUserNameAndPassword", "Debug LoadStaffDetailsByUserNameAndPassword Method", DayCarePL.Common.GUID_DEFAULT);
                objStaff = (from s in db.Staffs
                            join ssy in db.StaffSchoolYears on s.Id equals ssy.StaffId
                            join ug in db.UserGroups on s.UserGroupId equals ug.Id
                            where s.UserName.Equals(UserName) && s.Password.Equals(Password) && ug.SchoolId.Equals(SchoolId) && ssy.active.Value.Equals(true)
                            select new DayCarePL.StaffProperties()
                {
                    Id = s.Id,
                    UserGroupId = s.UserGroupId,
                    StaffCategoryId = s.StaffCategoryId,
                    FirstName = s.FirstName,
                    LastName = s.LastName,
                    FullName = s.FirstName + " " + s.LastName,
                    Address1 = s.Address1,
                    Address2 = s.Address2,
                    City = s.City,
                    Zip = s.Zip,
                    StateId = s.StateId,
                    CountryId = s.CountryId,
                    MainPhone = s.MainPhone,
                    SecondaryPhone = s.SecondaryPhone,
                    Email = s.Email,
                    UserName = s.UserName,
                    Password = s.Password,
                    Code = s.code,
                    Gender = s.gender,
                    SecurityQuestion = s.SecurityQuestion,
                    SecurityAnswer = s.SecurityAnswer,
                    Photo = s.Photo,
                    Active = ssy.active.Value,
                    Comments = s.Comments,
                    Message = s.Message,
                    //IsPrimary = s.IsPrimary,
                    CreatedById = s.CreatedById,
                    CreatedDateTime = s.CreatedDateTime,
                    LastModifiedById = s.LastModifiedById,
                    LastModifiedDatetime = s.LastModifiedDatetime,
                    SchoolId = ug.SchoolId,
                    UserGroupTitle = ug.GroupTitle,
                    RolId = ug.RoleId
                }).SingleOrDefault();

                if (objStaff != null)
                {
                    var currentyearid = (from ssy in db.StaffSchoolYears
                                         join sy in db.SchoolYears on ssy.SchoolYearId equals sy.Id
                                         where ssy.StaffId.Equals(objStaff.Id) && sy.CurrentId.Equals(true)
                                         select new
                    {
                        id = sy.Id
                    });

                    objStaff.ScoolYearId = currentyearid.Select(id => id.id).SingleOrDefault();
                    if (objStaff.ScoolYearId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        objStaff = null;
                    }
                }
                return(objStaff);
            }
            catch (Exception ex)
            {
                // DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clStaff, "LoadStaffDetailsByUserNameAndPassword", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }
Exemplo n.º 17
0
        public static DayCarePL.StaffProperties LoadStaffBystaffId(Guid StaffId, Guid CurrentSchoolYearId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clStaff, "LoadStaffBystaffId", "Execute LoadStaffBystaffId Method", DayCarePL.Common.GUID_DEFAULT);
            clConnection.DoConnection();
            DayCareDataContext db = new DayCareDataContext();

            DayCarePL.StaffProperties objStaff = null;
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.clStaff, "LoadStaffBystaffId", "Debug LoadStaffBystaffId Method", DayCarePL.Common.GUID_DEFAULT);
                var StaffData = (from s in db.Staffs
                                 join ssy in db.StaffSchoolYears on s.Id equals ssy.StaffId
                                 join ug in db.UserGroups on s.UserGroupId equals ug.Id into usergrooup
                                 join sg in db.StaffCategories on s.StaffCategoryId equals sg.Id into staffcategory
                                 join c in db.Countries on s.CountryId equals c.Id into country
                                 join st in db.States on s.StateId equals st.Id into states
                                 from usrgrp in usergrooup.DefaultIfEmpty()
                                 from stcag in staffcategory.DefaultIfEmpty()
                                 from ctry in country.DefaultIfEmpty()
                                 from state in states.DefaultIfEmpty()
                                 where s.Id.Equals(StaffId) && ssy.SchoolYearId.Equals(CurrentSchoolYearId)
                                 select new DayCarePL.StaffProperties()
                {
                    Id = s.Id,
                    UserGroupId = s.UserGroupId,
                    StaffCategoryId = s.StaffCategoryId,
                    FirstName = s.FirstName,
                    LastName = s.LastName,
                    FullName = s.FirstName + " " + s.LastName,
                    Address1 = s.Address1,
                    Address2 = s.Address2,
                    City = s.City,
                    Zip = s.Zip,
                    StateId = s.StateId,
                    CountryId = s.CountryId,
                    MainPhone = s.MainPhone,
                    SecondaryPhone = s.SecondaryPhone,
                    Email = s.Email,
                    UserName = s.UserName,
                    Password = s.Password,
                    Code = s.code,
                    Gender = s.gender,
                    SecurityQuestion = s.SecurityQuestion,
                    SecurityAnswer = s.SecurityAnswer,
                    Photo = s.Photo,
                    Active = ssy.active.Value,
                    Comments = s.Comments,
                    Message = s.Message,
                    //IsPrimary = s.IsPrimary,
                    CreatedById = s.CreatedById,
                    CreatedDateTime = s.CreatedDateTime,
                    LastModifiedById = s.LastModifiedById,
                    LastModifiedDatetime = s.LastModifiedDatetime,
                    UserGroupTitle = usrgrp.GroupTitle,
                    StaffCategoryName = stcag.Name,
                    CountryName = ctry.Name,
                    StateName = state.Name
                }).Single();

                objStaff = StaffData;

                //if (objStaff != null)
                //{
                //    var UserGroupTitle = from ugt in db.UserGroups
                //                         where ugt.Id.Equals(objStaff.UserGroupId)
                //                         select new
                //                         {
                //                             Title = ugt.GroupTitle
                //                         };
                //    objStaff.UserGroupTitle = UserGroupTitle.Select(ugt => ugt.Title).SingleOrDefault();

                //    var StaffCategoryName = from scn in db.StaffCategories
                //                            where scn.Id.Equals(objStaff.StaffCategoryId)
                //                            select new
                //                            {
                //                                CategoryName = scn.Name
                //                            };
                //    objStaff.StaffCategoryName = StaffCategoryName.Select(scn => scn.CategoryName).SingleOrDefault();

                //    var CountryName = from c in db.Countries
                //                      where c.Id.Equals(objStaff.CountryId)
                //                      select new
                //                      {
                //                          Name = c.Name
                //                      };
                //    objStaff.CountryName = CountryName.Select(cn => cn.Name).SingleOrDefault();

                //    var StateName = from s in db.States
                //                    where s.Id.Equals(objStaff.StateId)
                //                    select new
                //                    {
                //                        Name = s.Name
                //                    };
                //    objStaff.StateName = StateName.Select(s => s.Name).SingleOrDefault();

                //}
                return(objStaff);
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.clStaff, "LoadStaffBystaffId", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                return(null);
            }
        }