예제 #1
0
        /// <summary>
        /// Convert a nettiers collection to the ws proxy collection.
        /// </summary>
        public static VEmployee Convert(WsProxy.VEmployee item)
        {
            VEmployee outItem = new VEmployee();

            outItem.EmployeeId            = item.EmployeeId;
            outItem.Title                 = item.Title;
            outItem.FirstName             = item.FirstName;
            outItem.MiddleName            = item.MiddleName;
            outItem.LastName              = item.LastName;
            outItem.Suffix                = item.Suffix;
            outItem.JobTitle              = item.JobTitle;
            outItem.Phone                 = item.Phone;
            outItem.EmailAddress          = item.EmailAddress;
            outItem.EmailPromotion        = item.EmailPromotion;
            outItem.AddressLine1          = item.AddressLine1;
            outItem.AddressLine2          = item.AddressLine2;
            outItem.City                  = item.City;
            outItem.StateProvinceName     = item.StateProvinceName;
            outItem.PostalCode            = item.PostalCode;
            outItem.CountryRegionName     = item.CountryRegionName;
            outItem.AdditionalContactInfo = item.AdditionalContactInfo;

            outItem.AcceptChanges();
            return(outItem);
        }
        /// <summary>
        /// Deserialize the mock VEmployee entity from a temporary file.
        /// </summary>
        private void Step_7_DeserializeEntity_Generated()
        {
            string fileName = "temp_VEmployee.xml";

            XmlSerializer mySerializer = new XmlSerializer(typeof(VEmployee));

            System.IO.FileStream myFileStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open);
            mock = (VEmployee)mySerializer.Deserialize(myFileStream);
            myFileStream.Close();
            System.IO.File.Delete(fileName);

            System.Console.WriteLine("mock correctly deserialized from a temporary file.");
        }
예제 #3
0
        public void LoadTelContactData(string userid, string usertypeid)
        {
            //try
            //{

            TelContactsRepository dir = new  TelContactsRepository();

            Session["TelPersonContactData"] = dir.GetTelpersonContactList(userid.ToInt(), usertypeid.ToInt());

            GridView1.DataSource = Session["TelPersonContactData"];


            GridView1.DataBind();

            lblrecordcount.Text = string.Format("{0} : {1}", dir.TelContactCount().ToString().ToFarsiNumber(), Resources.DashboardText.RecordCount);

            lblSelectedDataCount.Text = string.Format("{0} : {1}", (Session["TelPersonContactData"] as DataTable).Rows.Count.ToString().ToFarsiNumber(), Resources.DashboardText.SelectRecordCount);

            switch (Session["UserTypeID"].ToString())
            {
            case "1":
            {
                VStudentsRepository vstdir = new VStudentsRepository();
                VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
            }
            break;

            case "2":
            {
                VLecturersRepository vlec = new VLecturersRepository();
                VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
            }
            break;

            case "3":
            {
                VEmployeesRepository vlec = new VEmployeesRepository();
                VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
            }
            break;
            }
            // }
            // catch
            // {
            ////    Redirector.Goto(Redirector.PageName.errorpage);
            // }
        }
예제 #4
0
        public void loadform()
        {
            try
            {
                lbluserid.Text     = Session["UserID"].ToString();
                lblusertypeid.Text = Session["UserTypeID"].ToString();
                EmailTypesRepository etr = new EmailTypesRepository();
                DataTable            dt  = etr.GetAllEmailTypes();
                ddlemailtype.Items.Clear();

                foreach (DataRow dr in dt.Rows)
                {
                    ddlemailtype.Items.Add(new ListItem(dr["EmailTypeTitle"].ToString(), dr["EmailTypeID"].ToString()));
                }



                switch (Session["UserTypeID"].ToString())
                {
                case "1":
                {
                    VStudentsRepository vstdir = new VStudentsRepository();
                    VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
                }
                break;

                case "2":
                {
                    VLecturersRepository vlec = new VLecturersRepository();
                    VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
                }
                break;

                case "3":
                {
                    VEmployeesRepository vlec = new VEmployeesRepository();
                    VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
                }
                break;
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }
예제 #5
0
        public VEmployee FindBynationalcode(string text)
        {
            VEmployee result = null;

            using (PersonsDBEntities DC = conn.GetContext())
            {
                //--  SELECT * FROM vPhoneList WHERE PhobeID = phoneID

                result = (from r in DC.VEmployees
                          where r.NationalCode == text
                          select r).FirstOrDefault();
            }

            return(result);
        }
예제 #6
0
        public VEmployee FindByuserName(string userName)
        {
            VEmployee result = null;

            using (PersonsDBEntities DC = conn.GetContext())
            {
                //--  SELECT * FROM vPhoneList WHERE PhobeID = phoneID

                result = (from r in DC.VEmployees
                          where r.Username == userName
                          select r).FirstOrDefault();
            }

            return(result);
        }
예제 #7
0
        public VEmployee FindByid(int id)
        {
            VEmployee result = null;

            using (PersonsDBEntities DC = conn.GetContext())
            {
                //--  SELECT * FROM vPhoneList WHERE PhobeID = phoneID

                result = (from r in DC.VEmployees
                          where r.EmployeeID == id
                          select r).FirstOrDefault();
            }

            return(result);
        }
        ///<summary>
        ///  Returns a Typed VEmployee Entity with mock values.
        ///</summary>
        static public VEmployee CreateMockInstance()
        {
            VEmployee mock = new VEmployee();

            mock.EmployeeId            = TestUtility.Instance.RandomNumber();
            mock.Title                 = TestUtility.Instance.RandomString(8, false);;
            mock.FirstName             = TestUtility.Instance.RandomString(24, false);;
            mock.MiddleName            = TestUtility.Instance.RandomString(24, false);;
            mock.LastName              = TestUtility.Instance.RandomString(24, false);;
            mock.Suffix                = TestUtility.Instance.RandomString(10, false);;
            mock.JobTitle              = TestUtility.Instance.RandomString(24, false);;
            mock.Phone                 = TestUtility.Instance.RandomString(11, false);;
            mock.EmailAddress          = TestUtility.Instance.RandomString(24, false);;
            mock.EmailPromotion        = TestUtility.Instance.RandomNumber();
            mock.AddressLine1          = TestUtility.Instance.RandomString(29, false);;
            mock.AddressLine2          = TestUtility.Instance.RandomString(29, false);;
            mock.City                  = TestUtility.Instance.RandomString(14, false);;
            mock.StateProvinceName     = TestUtility.Instance.RandomString(24, false);;
            mock.PostalCode            = TestUtility.Instance.RandomString(6, false);;
            mock.CountryRegionName     = TestUtility.Instance.RandomString(24, false);;
            mock.AdditionalContactInfo = "<test></test>";
            return((VEmployee)mock);
        }
예제 #9
0
        public void loadform()
        {
            try
            {
                EmailContactsRepository ecrir = new EmailContactsRepository();
                EmailContact            email = ecrir.FindByid(Session["ID"].ToString().ToInt());
                lblid.Text           = email.ID.ToString();
                lbluserid.Text       = Session["UserID"].ToString();
                lblusertypeid.Text   = Session["UserTypeID"].ToString();
                Session["EmailType"] = email.EmailTypeID.ToString();

                lblemailaddrress.Text = email.EmailAddrress;

                Session["newemailtype"] = email.EmailTypeID.ToString();


                switch (Session["UserTypeID"].ToString())
                {
                case "1":
                {
                    VStudentsRepository vstdir = new VStudentsRepository();
                    VStudent            std    = vstdir.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "دانشجو" + ":" + std.FirstName + " " + std.LastName;
                }
                break;

                case "2":
                {
                    VLecturersRepository vlec = new VLecturersRepository();
                    VLecturer            lec  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "استاد" + ":" + lec.FirstName + " " + lec.LastName;
                }
                break;

                case "3":
                {
                    VEmployeesRepository vlec = new VEmployeesRepository();
                    VEmployee            emp  = vlec.FindByid(Session["UserID"].ToString().ToInt());
                    Label9.Text = "کارمند" + ":" + emp.FirstName + " " + emp.LastName;
                }
                break;
                }



                EmailTypesRepository etir      = new EmailTypesRepository();
                EmailType            emailtype = etir.FindByid(Session["EmailType"].ToString().ToInt());
                if (emailtype != null)
                {
                    lblEmailtype.Text = emailtype.EmailTypeTitle;
                    // Label7.Text = std.FirstName.ToString() + " " + std.LastName.ToString();
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }


                EmailTypesRepository etr = new EmailTypesRepository();
                DataTable            dt2 = etr.GetAllEmailTypes();
                ddlemailtype.Items.Clear();

                foreach (DataRow dr in dt2.Rows)
                {
                    ddlemailtype.Items.Add(new ListItem(dr["EmailTypeTitle"].ToString(), dr["EmailTypeID"].ToString()));
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }
예제 #10
0
        public void loadform(string empid)
        {
            try
            {
                DepartmentsRepository depir = new DepartmentsRepository();
                DataTable             dep   = depir.GetAllDepartment();

                foreach (DataRow dr in dep.Rows)
                {
                    ddldep.Items.Add(new ListItem(dr["DepartmentTitle"].ToString(), dr["DepartmentID"].ToString()));
                }

                RolesRepository roleir = new RolesRepository();
                DataTable       role   = roleir.GetAllRoles();
                foreach (DataRow dr in role.Rows)
                {
                    ddlrole.Items.Add(new ListItem(dr["RoleTitle"].ToString(), dr["RoleID"].ToString()));
                }

                VEmployeesRepository vstir = new VEmployeesRepository();
                VEmployee            emp   = vstir.FindByid(empid.ToInt());
                if (emp != null)
                {
                    lblempid.Text    = emp.EmployeeID.ToString();
                    txtname.Text     = emp.FirstName;
                    txtlastname.Text = emp.LastName;
                    RadioButtonList1.SelectedValue = emp.Gender.ToString();
                    txtnationalcode.Text           = emp.NationalCode;
                    lbldep.Text  = emp.DepartmentTitle;
                    lblrole.Text = emp.RoleTitle;


                    lblusername.Text = emp.Username.ToString();
                    if (txtpass.Text != null)
                    {
                        txtpass.Text = emp.Password.ToString();
                    }

                    //  ImageButton1.ImageUrl = emp.ImageFileName;
                    Session["newdep"]  = emp.DepartmentID.ToString();
                    Session["pass"]    = emp.Password.ToString();
                    Session["newrole"] = emp.RoleID.ToString();

                    chkActiveAccount.Checked = (emp.Status.Value == 0 ? true : false);

                    Session["imageurl"] = emp.ImageFileName.ToString();
                    if (Session["imageurl"].ToString() != null)
                    {
                        ImageButton2.ImageUrl = "~/file/" + emp.ImageFileName;
                    }
                }
                else
                {
                    Redirector.Goto(Redirector.PageName.errorpage);
                }
            }
            catch
            {
                Redirector.Goto(Redirector.PageName.errorpage);
            }
        }