Example #1
0
    /// <summary>
    /// 获取一条AddNumber类信息
    /// </summary>
    /// <param name="AddNumberID">登录编号</param>
    /// <returns>一条AddNumber类记录</returns>
    public AddNumber GetAddNumber(string AddNumberID)
    {
        AddNumber addNumber = new AddNumber();
        Guide2Mgr g2Mgr     = new Guide2Mgr();
        GuideMgr  gMgr      = new GuideMgr();
        PersonMgr pMgr      = new PersonMgr();
        ClientMgr cMgr      = new ClientMgr();

        string    strSQL = "SELECT Top 1 * FROM Sys_AddNumber WHERE AddNumberID = " + AddNumberID;
        DataTable dt     = CMMgr.GetDataTable(strSQL);

        if (dt.Rows.Count > 0)
        {
            DataRow row = dt.Rows[0];
            addNumber.AddNumberID = int.Parse(row["AddNumberID"].ToString());
            addNumber.Title       = row["Title"].ToString();
            addNumber.Content     = row["Content"].ToString();
            addNumber.IsAudi      = row["IsAudi"].ToString();
            addNumber.Person      = pMgr.GetPerson(row["PersonID"].ToString());
            addNumber.Client      = cMgr.GetClient(row["ClientID"].ToString());
            addNumber.Guide2      = g2Mgr.GetGuide2(row["Guide2ID"].ToString());
            addNumber.Guide       = gMgr.GetGuide(row["GuideID"].ToString());
            addNumber.AddInt      = int.Parse(row["AddInt"].ToString());

            return(addNumber);
        }
        else
        {
            return(addNumber);
        }
    }
Example #2
0
        /// <summary>
        /// 传用户信息
        /// </summary>
        /// <returns></returns>
        public ActionResult BuyerInfo(int id)
        {
            List <TB_BUYER> lstBuyers = PersonMgr.GetBuyersInfo(id);

            ViewBag.BuyerId = lstBuyers;
            return(View());
        }
Example #3
0
    /// <summary>
    /// 获取一条Rewrite类信息
    /// </summary>
    /// <param name="RewriteID">登录编号</param>
    /// <returns>一条Rewrite类记录</returns>
    public Rewrite GetRewrite(string RewriteID)
    {
        Rewrite   rewrite = new Rewrite();
        ClientMgr g2Mgr   = new ClientMgr();
        PersonMgr pMgr    = new PersonMgr();

        string    strSQL = "SELECT Top 1 * FROM Sys_Rewrite WHERE RewriteID = " + RewriteID;
        DataTable dt     = CMMgr.GetDataTable(strSQL);

        if (dt.Rows.Count > 0)
        {
            DataRow row = dt.Rows[0];
            rewrite.RewriteID = int.Parse(row["RewriteID"].ToString());
            rewrite.Title     = row["Title"].ToString();
            rewrite.Content   = row["Content"].ToString();
            rewrite.InputDate = DateTime.Parse(row["InputDate"].ToString());
            rewrite.Person    = pMgr.GetPerson(row["PersonID"].ToString());
            rewrite.Client    = g2Mgr.GetClient(row["ClientID"].ToString());
            rewrite.ReContent = row["ReContent"].ToString();

            return(rewrite);
        }
        else
        {
            return(rewrite);
        }
    }
Example #4
0
    /// <summary>
    /// 获取一条Asses类信息
    /// </summary>
    /// <param name="AssesID">登录编号</param>
    /// <returns>一条Asses类记录</returns>
    public Asses GetAsses(string AssesID)
    {
        Asses     asses = new Asses();
        GuideMgr  gMgr  = new GuideMgr();
        Guide2Mgr g2Mgr = new Guide2Mgr();
        PersonMgr pMgr  = new PersonMgr();

        string    strSQL = "SELECT Top 1 * FROM Sys_Asses WHERE AssesID = " + AssesID;
        DataTable dt     = CMMgr.GetDataTable(strSQL);

        if (dt.Rows.Count > 0)
        {
            DataRow row = dt.Rows[0];
            asses.AssesID     = int.Parse(row["AssesID"].ToString());
            asses.Person      = pMgr.GetPerson(row["PersonID"].ToString());
            asses.Guide       = gMgr.GetGuide(row["GuideID"].ToString());
            asses.Guide2      = g2Mgr.GetGuide2(row["Guide2ID"].ToString());
            asses.Scale1      = int.Parse(row["Scale1"].ToString());
            asses.Scale2      = int.Parse(row["Scale2"].ToString());
            asses.Scale3      = int.Parse(row["Scale3"].ToString());
            asses.Scale1Name  = row["Scale1Name"].ToString();
            asses.Scale2Name  = row["Scale2Name"].ToString();
            asses.Scale3Name  = row["Scale3Name"].ToString();
            asses.CountNumber = int.Parse(row["CountNumber"].ToString());
            asses.Memo        = row["Memo"].ToString();

            return(asses);
        }
        else
        {
            return(asses);
        }
    }
    private void initPerson()
    {
        PersonMgr mgr = new PersonMgr();

        this.lstPersonID.DataSource     = mgr.GetPersonList("", "");
        this.lstPersonID.DataTextField  = "PersonName";
        this.lstPersonID.DataValueField = "PersonID";
        this.lstPersonID.DataBind();
    }
Example #6
0
    /// <summary>
    /// 初始化人员列表信息
    /// </summary>
    private void initForm()
    {
        PersonMgr mgr      = new PersonMgr();
        DataTable dtNumber = mgr.GetPersonList(this.txtAssesID.Text, this.txtAssesName.Text);

        this.dgList.DataSource = dtNumber;
        this.lblNumber.Text    = "共" + dtNumber.Rows.Count.ToString() + "条记录";
        this.dgList.DataBind();
    }
Example #7
0
        /// <summary>
        /// 获取用户信息
        /// </summary>
        /// <returns></returns>
        public JsonResult GetBuyersInfo(int?id)
        {
            List <TB_BUYER> lstBuyers = PersonMgr.GetBuyersInfo(id);

            return(Json(lstBuyers));
        }
Example #8
0
        /// <summary>
        /// 获取未评价详单
        /// </summary>
        /// <param name="multi"></param>
        /// <returns></returns>
        public JsonResult GetUnevaluateDetailOrders(string multi)
        {
            List <Orders> lstGoods = PersonMgr.GetUnevaluateDetailOrders(multi);

            return(Json(lstGoods));
        }
Example #9
0
        /// <summary>
        /// 获取未评价订单
        /// </summary>
        /// <returns></returns>
        public JsonResult GetUnevaluateOrders(int?id)
        {
            List <Orders> lstGoods = PersonMgr.GetUnevaluateOrders(id);

            return(Json(lstGoods));
        }
Example #10
0
        /// <summary>
        /// 获取收藏商品的信息
        /// </summary>
        /// <returns></returns>
        public JsonResult GetGoodsInfo(int?id)
        {
            List <Collect_Goods> lstGoods = PersonMgr.GetCollectGoodsInfo(id);

            return(Json(lstGoods));
        }
Example #11
0
        /// <summary>
        /// 获取收藏店铺信息
        /// </summary>
        /// <returns></returns>
        public JsonResult GetCollectShopsInfo(int?id)
        {
            List <Collect_Shops> lstShops = PersonMgr.GetCollectShopsInfo(id);

            return(Json(lstShops));
        }
Example #12
0
        /// <summary>
        /// 修改用户密码
        /// </summary>
        /// <param name="buyer"></param>
        /// <returns></returns>
        public JsonResult AltPwd(TB_BUYER buyer, int id)
        {
            bool res = PersonMgr.AltPwd(buyer, id);

            return(Json(res));
        }
Example #13
0
        public JsonResult AltOrder(TB_ORDER order, int ORDER_NO)
        {
            bool model = PersonMgr.AltOrder(order, ORDER_NO);

            return(Json(model));
        }
Example #14
0
        public String Put(Raw raw)
        {
            bool bAllowNoAddress;

            if ((bAllowNoAddress = (raw.type == "Person2")) && (raw.data != null))
            {
                var settings = new JsonSerializerSettings {
                    TypeNameHandling = TypeNameHandling.All
                };
                var data = JsonConvert.DeserializeObject <Attendance.PFullInfo>(raw.data, settings);
                raw.type = "Person";
                raw.data = data.ToString();
            }

            if (raw.type == "PersonANA")
            {
                bAllowNoAddress = true;
                raw.type        = "Person";
            }

            if (((raw.type == "Person") || (raw.type == "DeletePerson")) && (raw.data != null))
            {
                // Generate Key/Value Pairs to update person
                char[] outerDelims = { ';', '~', '&', ',' };
                char[] innerDelims = { ':', '=' };

                string[] pairs = raw.data.Split(outerDelims);

                List <KeyValuePair <string, string> > props = new List <KeyValuePair <string, string> >();
                foreach (string nvs in pairs)
                {
                    string[] nvp = nvs.Split(innerDelims);
                    if ((nvp.Length == 2) && (nvp[1].Length > 0))
                    {
                        props.Add(new KeyValuePair <string, string>(nvp[0], nvp[1]));
                    }
                }

                PersonMgr pmgr = new PersonMgr(entities);

                if (raw.type == "DeletePerson")
                {
                    return(pmgr.DeletePerson(ref props));
                }

                Person  rp;
                Address ra;

                MgrStatus result = pmgr.Update(ref props, false, bAllowNoAddress, out rp, out ra);

                if (result == MgrStatus.Add_Update_Succeeded)
                {
                    if ((rp != null) && (rp.Id > 0))
                    {
                        return("Update/Add Succeeded:" + "[" + rp.Id + "]");
                    }
                    else
                    {
                        return("Update/Add Succeeded.");
                    }
                }
                else
                {
                    return("FAIL:" + result.ToString());
                }
            }
            else if (raw.type == "Event")
            {
                var settings = new JsonSerializerSettings
                {
                    TypeNameHandling       = TypeNameHandling.Objects,
                    TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full
                };

                var             ev   = JsonConvert.DeserializeObject <Event.EventData>(raw.data, settings);
                Event.EventData ed   = (Event.EventData)ev;
                EventMgr        emgr = new EventMgr(entities);
                MgrStatus       ms   = emgr.Update(ed);
                return("Event " + raw.type + " " + ms.ToString());
            }
            else if (raw.type == "Church")
            {
                //var settings = new JsonSerializerSettings
                //{
                //    TypeNameHandling = TypeNameHandling.Objects,
                //    TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple
                //};

                var cv = JsonConvert.DeserializeObject <Church.ChurchData>(raw.data);
                Church.ChurchData cd   = (Church.ChurchData)cv;
                ChurchMgr         cmgr = new ChurchMgr(entities);
                MgrStatus         ms   = cmgr.Update(cd);
                return(ms.ToString());
            }
            else if (raw.type == "Attendance")
            {
                var settings = new JsonSerializerSettings
                {
                    TypeNameHandling       = TypeNameHandling.Objects,
                    TypeNameAssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Full
                };

                var atd = JsonConvert.DeserializeObject <Attendance.AttData>(raw.data, settings);

                AttendanceMgr amgr       = new AttendanceMgr(entities);
                String        resultsStr = "";
                MgrStatus     ams        = amgr.Update(atd);
                if (resultsStr.Length > 0)
                {
                    resultsStr = String.Join(",", resultsStr, ams.ToString());
                }
                else
                {
                    resultsStr = ams.ToString();
                }

                return(resultsStr);
            }

            return("FAIL: Type:" + raw.type + " Not Handled.");
        }
Example #15
0
    protected void btnLogin_Click(object sender, ImageClickEventArgs e)
    {
        switch (this.lstLoginType.SelectedValue)
        {
        case "管理员":
            AdminMgr aMgr  = new AdminMgr();
            Admin    admin = aMgr.GetAdmin(this.txtLoginName.Text);
            if (admin.AdminID != "")
            {
                if (this.txtPassword.Text == admin.Password)
                {
                    this.eUserID   = admin.AdminID;
                    this.eUserName = admin.AdminName;
                    this.eUserType = "管理员";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "教师":
            ClientMgr pMgr   = new ClientMgr();
            Client    client = pMgr.GetClient(this.txtLoginName.Text);
            if (client.ClientID != "")
            {
                if (this.txtPassword.Text == client.Password)
                {
                    this.eUserID   = client.ClientID;
                    this.eUserName = client.ClientName;
                    this.eUserType = "教师";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该教师");
            }
            break;

        case "学生":
            PersonMgr cMgr   = new PersonMgr();
            Person    person = cMgr.GetPerson(this.txtLoginName.Text);
            if (person.PersonID != "")
            {
                if (this.txtPassword.Text == person.Password)
                {
                    this.eUserID   = person.PersonID;
                    this.eUserName = person.PersonName;
                    this.eUserType = "学生";
                    Response.Redirect("MainFrame.aspx");
                }
                else
                {
                    this.SendMessage("密码不正确");
                }
            }
            else
            {
                this.SendMessage("没有找到该学生");
            }
            break;
        }
    }
Example #16
0
        // GET api/values/5
        public string Get(string id) //********************************************************
        {
            if (id == null)
            {
                return("Bad Get id");
            }

            id = id.Replace("@@", "*");

            String MatchingChurchesStr   = "Matching_Churches:";
            int    MatchingChurchesIndex = id.IndexOf(MatchingChurchesStr);

            if (MatchingChurchesIndex >= 0)
            {
                id = id.Trim();
                String    ChurchHint = id.Substring(MatchingChurchesIndex + MatchingChurchesStr.Length).Trim();
                ChurchMgr cmgr       = new ChurchMgr(entities);
                return(cmgr.FindChurches(ChurchHint));
            }

            String MatchingEventsStr   = "Matching_Events:";
            int    MatchingEventsIndex = id.IndexOf(MatchingEventsStr);

            if (MatchingEventsIndex >= 0)
            {
                id = id.Trim();
                String   EventHint = id.Substring(MatchingEventsIndex + MatchingEventsStr.Length).Trim();
                EventMgr emgr      = new EventMgr(entities);
                return(emgr.FindEvents(EventHint));
            }

            String DeleteEventStr   = "Delete_Event:";
            int    DeleteEventIndex = id.IndexOf(DeleteEventStr);

            if (DeleteEventIndex >= 0)
            {
                id = id.Trim();
                String   idStr = id.Substring(DeleteEventIndex + DeleteEventStr.Length).Trim();
                EventMgr emgr  = new EventMgr(entities);
                if (idStr.Length > 0)
                {
                    int idVal = Int32.Parse(idStr);
                    return(emgr.DeleteEvent(idVal));
                }
                else
                {
                    return("Missing Event id to Delete");
                }
            }

            // FindAttendance:id=

            // Matching_Attendees:eid=
            // Matching_Attendees:" + "eyear = " + ystr + "; etype = " + DescStr;
            String MatchingAttendeesStr   = "Matching_Attendees:";
            int    MatchingAttendeesIndex = id.IndexOf(MatchingAttendeesStr);

            if (MatchingAttendeesIndex >= 0)
            {
                id = id.Trim();
                String        AttendeeHint = id.Substring(MatchingAttendeesIndex + MatchingAttendeesStr.Length).Trim();
                AttendanceMgr amgr         = new AttendanceMgr(entities);
                return(amgr.FindAttendees(AttendeeHint));
            }

            String DeleteChurchStr   = "Delete_Church:";
            int    DeleteChurchIndex = id.IndexOf(DeleteChurchStr);

            if (DeleteChurchIndex >= 0)
            {
                id = id.Trim();
                String    idStr = id.Substring(DeleteChurchIndex + DeleteChurchStr.Length).Trim();
                ChurchMgr cmgr  = new ChurchMgr(entities);
                if (idStr.Length > 0)
                {
                    int idVal = Int32.Parse(idStr);
                    return(cmgr.DeleteChurch(idVal));
                }
                else
                {
                    return("Missing Church id to Delete");
                }
            }

            String MatchingNamesStr   = "Matching_Names:";
            int    MatchingNamesIndex = id.IndexOf("Matching_Names:");

            if (MatchingNamesIndex >= 0)
            {
                id = id.Trim();
                String FNTarget = id.Substring(MatchingNamesIndex + MatchingNamesStr.Length).Trim();
                String LNTarget;
                if (FNTarget.Length == 0)
                {
                    return("No Name to Match");
                }
                int SPIndex = FNTarget.LastIndexOf(' ');
                if (SPIndex != -1)
                {
                    LNTarget = FNTarget.Substring(SPIndex + 1).Trim();
                    FNTarget = FNTarget.Substring(0, SPIndex).Trim();
                }
                else
                {
                    LNTarget = "";
                }

                List <PInfo> PInfoList = new List <PInfo>();
                String       falias    = "F:" + FNTarget;
                if (LNTarget.Length > 0)
                {
                    String lalias      = "L:" + LNTarget;
                    var    PInfoListFL = (from p in entities.Person
                                          where (p.FirstName.ToLower().StartsWith(FNTarget.ToLower()) || ((p.Alias != null) && (p.Alias == falias))) &&
                                          (p.LastName.ToLower().StartsWith(LNTarget.ToLower()) || ((p.Alias != null) && (p.Alias == lalias)))
                                          join a in entities.Address on
                                          p.AddressId equals a.Id
                                          join c in entities.Church on
                                          p.ChurchId equals c.Id into pc
                                          from pcn in pc.DefaultIfEmpty()
                                          select new { p.Id, p.FirstName, p.LastName, p.Ssnum, a.ZipCode, pcn.Name, p.Alias }).ToList();

                    var jsonPG = JsonConvert.SerializeObject(PInfoListFL, Formatting.None, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    return(jsonPG.ToString());
                }
                else
                {
                    var PInfoListF = (from p in entities.Person
                                      where (p.FirstName.ToLower().StartsWith(FNTarget.ToLower()) || ((p.Alias != null) && (p.Alias == falias))) ||
                                      (p.LastName.ToLower().StartsWith(FNTarget.ToLower()) || ((p.Alias != null) && (p.Alias == falias)))
                                      join a in entities.Address on
                                      p.AddressId equals a.Id
                                      join c in entities.Church on
                                      p.ChurchId equals c.Id into pc
                                      from pcn in pc.DefaultIfEmpty()
                                      select new { p.Id, p.FirstName, p.LastName, p.Ssnum, a.ZipCode, pcn.Name }).ToList();

                    var jsonPG = JsonConvert.SerializeObject(PInfoListF, Formatting.None, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    return(jsonPG.ToString());
                }
            }

            String target       = "Lookup Person:";
            int    lookup_index = id.IndexOf(target);

            if (lookup_index >= 0)
            {
                String pidStr = id.Substring(lookup_index + target.Length);
                int    pid    = Int32.Parse(pidStr);

                String PG1Str = null, PG2Str = null;
                int    PG1_id = 0, PG2_id = 0;

                //var PList = from p in entities.People
                //            where p.id == pid
                //            join a in entities.Addresses on
                //            p.Address_id equals a.id
                //            join c in entities.Churches on
                //            p.Church_id equals c.id into pc
                //            from pcn in pc.DefaultIfEmpty()
                //            select p;

                var PList = from p in entities.Person
                            where p.Id == pid
                            join a in entities.Address on
                            p.AddressId equals a.Id into pa
                            from a in pa.DefaultIfEmpty()
                            join c in entities.Church on
                            p.ChurchId equals c.Id into pc
                            from c in pc.DefaultIfEmpty()
                            from pcn in pc.DefaultIfEmpty()
                            select p;

                var pgObj  = new PG();
                var MPList = new List <MinPerson>();

                foreach (Person pr in PList)
                {
                    pr.FirstName = PersonMgr.MakeFirstName(pr);
                    pr.LastName  = PersonMgr.MakeLastName(pr);

                    // TEST pr.PG1_Person_id = 3;
                    // TEST pr.PG2_Person_id = 4;

                    if (pr.AddressId != null)
                    {
                        pgObj.Adr_id = (int)pr.AddressId;
                    }

                    Person p1 = entities.Person.FirstOrDefault(p => p.Id == pr.Pg1PersonId);
                    if (p1 != null)
                    {
                        p1.FirstName = PersonMgr.MakeFirstName(p1);
                        p1.LastName  = PersonMgr.MakeLastName(p1);
                        PG1Str       = p1.FirstName + " " + p1.LastName;
                        PG1_id       = p1.Id;
                    }

                    Person p2 = entities.Person.FirstOrDefault(p => p.Id == pr.Pg2PersonId);
                    if (p2 != null)
                    {
                        p2.FirstName = PersonMgr.MakeFirstName(p2);
                        p2.LastName  = PersonMgr.MakeLastName(p2);
                        PG2Str       = p2.FirstName + " " + p2.LastName;
                        PG2_id       = p2.Id;
                    }

                    if ((PG1Str != null) || (PG2Str != null))
                    {
                        if (PG1Str != null)
                        {
                            pgObj.PG1Name = PG1Str;
                            pgObj.PG1_id  = PG1_id;
                        }
                        if (PG2Str != null)
                        {
                            pgObj.PG2Name = PG2Str;
                            pgObj.PG2_id  = PG2_id;
                        }

                        var jsonPG = JsonConvert.SerializeObject(pgObj, Formatting.None, new JsonSerializerSettings()
                        {
                            ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                        });
                        pr.ContactPref = jsonPG.ToString();
                    }

                    var m = new MinPerson();
                    m.FirstName     = pr.FirstName;
                    m.LastName      = pr.LastName;
                    m.id            = pr.Id;
                    m.Alias         = pr.Alias;
                    m.DOB           = pr.Dob;
                    m.Gender        = pr.Gender;
                    m.Status        = pr.Status;
                    m.SSNum         = pr.Ssnum;
                    m.Address_id    = pr.AddressId;
                    m.PG1_Person_id = pr.Pg1PersonId;
                    m.PG2_Person_id = pr.Pg2PersonId;
                    m.Church_id     = pr.ChurchId;
                    m.SkillSets     = pr.SkillSets;
                    m.CellPhone     = pr.CellPhone;
                    m.EMail         = pr.Email;
                    m.ContactPref   = pr.ContactPref;
                    m.Notes         = pr.Notes;
                    if (pr.Address != null)
                    {
                        m.Address.id      = pr.Address.Id;
                        m.Address.Street  = pr.Address.Street;
                        m.Address.Town    = pr.Address.Town;
                        m.Address.State   = pr.Address.State;
                        m.Address.ZipCode = pr.Address.ZipCode;
                        m.Address.Phone   = pr.Address.Phone;
                        m.Address.Fax     = pr.Address.Fax;
                        m.Address.Country = pr.Address.Country;
                        m.Address.WebSite = pr.Address.WebSite;
                    }
                    MPList.Add(m);
                }

                if (MPList != null)
                {
                    var json = JsonConvert.SerializeObject(MPList, Formatting.None, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    string jstr = json.ToString();
                    return(jstr);
                }
                else
                {
                    return("Lookup Failed with id:" + pid);
                }
            }

            //******************************************************
            // MULTI_FIELD FIND PEOPLE SEARCH
            //******************************************************

            // Generate Key/Value Pairs to update person
            char[] outerDelims = { ';', '~', '&' };
            char[] innerDelims = { ':', '=' };

            string[] pairs = id.Split(outerDelims);

            List <KeyValuePair <string, string> > props = new List <KeyValuePair <string, string> >();

            foreach (string nvs in pairs)
            {
                string[] nvp = nvs.Split(innerDelims);
                if ((nvp.Length == 2) && (nvp[1].Length > 0))
                {
                    props.Add(new KeyValuePair <string, string>(nvp[0], nvp[1]));
                }
            }

            // SQL Based Query

            String sel       = "Select * from Person FULL OUTER JOIN Address ON (Person.Address_id = Address.id)";
            int    orgSelLen = sel.Length;
            bool   bFiltered = false;

            PersonMgr pmgr = new PersonMgr(entities);
            Person    fp;
            Address   fa;

            if (pmgr.Update(ref props, true, true, out fp, out fa) != MgrStatus.Add_Update_Succeeded)
            {
                return("Invalid Search Criteria");
            }

            PersonMgr.AddToSelect(ref sel, "Person.FirstName", fp.FirstName, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.LastName", fp.LastName, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Address.Street", fa.Street, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Address.Town", fa.Town, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.CellPhone", fp.CellPhone, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.EMail", fp.Email, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.Church_id", fp.ChurchId, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.SSNum", fp.Ssnum, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Address.State", fa.State, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.Gender", fp.Gender.GetValueOrDefault(0), ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.SkillSets", fp.SkillSets, ref bFiltered);
            PersonMgr.AddToSelect(ref sel, "Person.Status", fp.Status, ref bFiltered);
            if (!fp.Dob.GetValueOrDefault().Equals(new DateTime(1900, 1, 1)))
            {
                PersonMgr.AddToSelect(ref sel, "Person.DOB", fp.Dob.GetValueOrDefault(), true, ref bFiltered);
            }

            if (sel.Length == orgSelLen)
            {
                sel += "order by Address.Street ASC";
            }

            //                Also, it is recommended to use ISO8601 format YYYY - MM - DDThh:mm: ss.nnn[Z], as this one will not depend on your server's local culture.
            //SELECT*
            //FROM TABLENAME
            //WHERE
            //    DateTime >= '2011-04-12T00:00:00.000' AND
            //    DateTime <= '2011-05-25T03:53:04.000'

            try
            {
                var PList = entities.Person.FromSqlRaw(sel).ToList <Person>();

                var MPList = new List <MinPerson>();

                if (PList != null)
                {
                    foreach (var p in PList)
                    {
                        if (p == null)
                        {
                            continue;
                        }
                        var m = new MinPerson();
                        m.FirstName     = p.FirstName;
                        m.LastName      = p.LastName;
                        m.id            = p.Id;
                        m.Alias         = p.Alias;
                        m.DOB           = p.Dob;
                        m.Gender        = p.Gender;
                        m.Status        = p.Status;
                        m.SSNum         = p.Ssnum;
                        m.Address_id    = p.AddressId;
                        m.PG1_Person_id = p.Pg1PersonId;
                        m.PG2_Person_id = p.Pg2PersonId;
                        m.Church_id     = p.ChurchId;
                        m.SkillSets     = p.SkillSets;
                        m.CellPhone     = p.CellPhone;
                        m.EMail         = p.Email;
                        m.ContactPref   = p.ContactPref;
                        m.Notes         = p.Notes;
                        if (p.Address != null)
                        {
                            m.Address.id      = p.Address.Id;
                            m.Address.Street  = p.Address.Street;
                            m.Address.Town    = p.Address.Town;
                            m.Address.State   = p.Address.State;
                            m.Address.ZipCode = p.Address.ZipCode;
                            m.Address.Phone   = p.Address.Phone;
                            m.Address.Fax     = p.Address.Fax;
                            m.Address.Country = p.Address.Country;
                            m.Address.WebSite = p.Address.WebSite;
                        }
                        else
                        {
                            m.Address.Street  = "";
                            m.Address.Town    = "";
                            m.Address.State   = "";
                            m.Address.ZipCode = "";
                            m.Address.Phone   = "";
                            m.Address.Fax     = "";
                            m.Address.Country = "";
                            m.Address.WebSite = "";
                        }
                        MPList.Add(m);
                    }
                }

                if (MPList.Count > 0)
                {
                    var json = JsonConvert.SerializeObject(MPList, Formatting.None, new JsonSerializerSettings()
                    {
                        ReferenceLoopHandling = ReferenceLoopHandling.Ignore
                    });
                    string jstr = json.ToString();
                    return(jstr);
                }
            }
            catch (Exception)
            {
            }

            return("ERROR~:No one found with Name");
        }
Example #17
0
    protected void dgList_ItemDataBound(object sender, DataGridItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            HyperLink hyGuide1 = (HyperLink)e.Item.FindControl("hyGuide1");
            HyperLink hyGuide2 = (HyperLink)e.Item.FindControl("hyGuide2");
            HyperLink hyGuide3 = (HyperLink)e.Item.FindControl("hyGuide3");
            GuideMgr  gMgr     = new GuideMgr();
            Guide     guide1   = gMgr.GetGuide("1");
            Guide     guide2   = gMgr.GetGuide("2");
            Guide     guide3   = gMgr.GetGuide("3");

            hyGuide1.Text = "0";
            hyGuide2.Text = "0";
            hyGuide3.Text = "0";
            PersonMgr mgr    = new PersonMgr();
            Person    person = mgr.GetPerson(e.Item.Cells[0].Text);
            AssesMgr  aMgr   = new AssesMgr();
            DataTable dt     = aMgr.GetAssesNumberList(person.PersonID, 1);
            foreach (DataRow row in dt.Rows)
            {
                hyGuide1.Text = (int.Parse(hyGuide1.Text) + int.Parse(row["Scale1"].ToString())).ToString();
            }
            if (hyGuide1.Text != "0")
            {
                if (int.Parse(hyGuide1.Text) > 100)
                {
                    hyGuide1.Text = "100";
                }
                hyGuide1.Text = (int.Parse(hyGuide1.Text) * guide1.Scale / 100).ToString();
            }

            dt = aMgr.GetAssesNumberList(person.PersonID, 2);
            foreach (DataRow row in dt.Rows)
            {
                hyGuide2.Text = (int.Parse(hyGuide2.Text) + int.Parse(row["Scale1"].ToString())).ToString();
            }
            if (hyGuide2.Text != "0")
            {
                if (int.Parse(hyGuide2.Text) > 100)
                {
                    hyGuide2.Text = "100";
                }
                hyGuide2.Text = (int.Parse(hyGuide2.Text) * guide2.Scale / 100).ToString();
            }

            dt = aMgr.GetAssesNumberList(person.PersonID, 3);
            foreach (DataRow row in dt.Rows)
            {
                hyGuide3.Text = (int.Parse(hyGuide3.Text) + int.Parse(row["Scale1"].ToString())).ToString();
            }
            if (hyGuide3.Text != "0")
            {
                if (int.Parse(hyGuide3.Text) > 100)
                {
                    hyGuide3.Text = "100";
                }
                hyGuide3.Text = (int.Parse(hyGuide3.Text) * guide3.Scale / 100).ToString();
            }

            e.Item.Cells[e.Item.Cells.Count - 1].Text = (int.Parse(hyGuide1.Text) + int.Parse(hyGuide2.Text) + int.Parse(hyGuide3.Text)).ToString();
        }
    }
Example #18
0
        public JsonResult GetShopInfo(int?id)
        {
            List <TB_SHOP> model = PersonMgr.GetShopInfo(id);

            return(Json(model));
        }
Example #19
0
        /// <summary>
        /// 通过用户ID查用户信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public JsonResult GetPersonByID(int id)
        {
            TB_BUYER model = PersonMgr.GetPersonById(id);

            return(Json(model));
        }