Exemplo n.º 1
0
        public JsonResult _PartialAddClassTeacher(ViewClassTeacher entity)
        {
            BasicInfo bi = Commons.Helper.Login.GetCurrentUser();

            if (bi.Uid > 0)
            {
                //添加到 YogaUser YogisModels

                ViewYogaUser item = new ViewYogaUser();

                ViewYogisModels model = new ViewYogisModels();

                #region 添加到 YogaUser

                item.RegDate      = DateTime.Now;
                item.UStatus      = 0;
                item.UEmail       = "";
                item.Uphone       = "";
                item.Pwd          = "";
                item.LastDate     = DateTime.Now;
                item.LoginTimes   = 0;
                item.LoginType    = (int)LoginType.普通;
                item.UserType     = (int)UserType.瑜伽导师;
                item.UStatus      = (int)Ustatus.未激活;
                item.IsAssessor   = false;
                item.IsWebworkers = false;

                item.YogisModels    = new List <YogisModels>();
                item.WechatAuthCode = "";
                item.WechatBack     = "";
                item.SinaAuthCode   = "";
                item.SinaBack       = "";
                item.QQAuthCode     = "";
                item.QQBack         = "";
                item.ValCode        = "";
                item.ValExpire      = DateTime.Now.AddYears(2);

                #endregion

                using (YogaUserServiceClient clientuser = new YogaUserServiceClient())
                {
                    var yuEntity = clientuser.Return_AddUid(item);
                    model.UID = yuEntity.Uid;
                }
                model.RealName   = entity.Name;
                model.DisplayImg = entity.Avatar;
                if (entity.Gender == "男")
                {
                    model.Gender = 1;
                }
                else if (entity.Gender == "女")
                {
                    model.Gender = 0;
                }

                model.CountryID = method.GetDicId(entity.Country);

                model.YogaTypeid        = method.GetYogaTypeid(entity.YogaSystem).TrimEnd(',');
                model.CreateDate        = DateTime.Now;
                model.YogiStatus        = 1;//1=普通导师
                model.IsAcceptAgreement = true;
                model.delState          = 0;
                //添加到 YogisModels
                using (YogisModelsServiceClient clientModel = new YogisModelsServiceClient())
                {
                    model = clientModel.Add_Model(model);
                }

                ClassTeacherServiceClient client = new ClassTeacherServiceClient();
                entity.UserId    = bi.Uid;
                entity.TeacherId = model.YID;
                entity.Id        = client.Add(entity);
            }
            return(Json(entity));
        }