Пример #1
0
        //adds a cooperation to the airport
        public void addCooperation(Cooperation cooperation)
        {
            this.Cooperations.Add(cooperation);
            this.Airport.addCooperation(cooperation);

            AirlineHelpers.AddAirlineInvoice(cooperation.Airline, cooperation.BuiltDate, Invoice.InvoiceType.Purchases, -cooperation.Type.Price);
        }
Пример #2
0
        public string CooperationJoin(CooperationDto coopdto)
        {
            using (var db = base.NewDB())
            {
                var dbitem = db.Users.FirstOrDefault(t => t.AuthID == coopdto.authid);

                if (dbitem == null)
                {
                    return("申请用户异常");
                }

                Cooperation coop = new Cooperation
                {
                    Address       = coopdto.address,
                    User          = dbitem,
                    AreaID        = coopdto.areaid,
                    Level         = coopdto.level,
                    Memo          = coopdto.memo,
                    MobilePhone   = coopdto.mobilephone,
                    Name          = coopdto.name,
                    Type          = coopdto.type,
                    AgentAreaInfo = coopdto.agentareainfo,
                    AreaInfo      = coopdto.areainfo
                };

                db.Cooperations.Add(coop);

                db.SaveChanges();

                return(string.Empty);
            }
        }
Пример #3
0
        public ActionResult SubmitCooperation(Cooperation entity)
        {
            var result = new OpResult();
            var userId = CurrentMember.MemberId.ToString();

            result = new CooperationService().SubmitCooperation(entity, userId);
            return(Json(result));
        }
Пример #4
0
        private void btnDeleteCooperation_Click(object sender, RoutedEventArgs e)
        {
            Cooperation cooperation = (Cooperation)((Button)sender).Tag;

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2231"), string.Format(Translator.GetInstance().GetString("MessageBox", "2231", "message"), cooperation.Type.Name), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                this.Airport.removeCooperation(cooperation);
            }
        }
Пример #5
0
        public ActionResult Cooperation()
        {
            var coopSvc = new CooperationService();
            var result  = coopSvc.FindByCustomerId(CurrentMember.MemberId.ToString());

            if (result.Status != 0)
            {
                result = new Cooperation();
            }
            return(View(result));
        }
Пример #6
0
        public static int AddItem(Cooperation item)
        {
            string spName = "cudo_createcooperation";

            SqlParameter[] paramValues = new SqlParameter[]
            {
                new SqlParameter("@shopname", item.ShopName),
                new SqlParameter("@username", item.UserName),
                new SqlParameter("@phone", item.Phone),
                new SqlParameter("@address", item.Address)
            };
            return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramValues));
        }
Пример #7
0
        private void FaceToData(ref Cooperation value)
        {
            value.Name        = this.NameID.Text;                       //姓名
            value.TelNo       = this.TelNoID.Text;                      //联系号码
            value.Email       = this.EmailID.Text;                      //Email
            value.ContactName = this.ContactNameID.Text;                //联系人姓名
            value.Fax         = this.FaxID.Text;                        //传真
            value.Address     = this.AddressID.Text;                    //地址
            value.CreateDate  = DateTime.Parse(this.CreateDateID.Text); //合作时间
            value.Remark      = this.RemarkID.Text;                     //备注

            value.Company = this.CurrentCompany;
        }
Пример #8
0
 private void DataToFace(Cooperation value)
 {
     if (value != null)
     {
         this.NameID.Text        = value.Name;                           //姓名
         this.TelNoID.Text       = value.TelNo;                          //联系号码
         this.EmailID.Text       = value.Email;                          //Email
         this.ContactNameID.Text = value.ContactName;                    //联系人姓名
         this.FaxID.Text         = value.Fax;                            //传真
         this.AddressID.Text     = value.Address;                        //地址
         this.CreateDateID.Text  = value.CreateDate.ToShortDateString(); //合作时间
         this.RemarkID.Text      = value.Remark;                         //备注
     }
 }
Пример #9
0
        /*
         * 插入交互字段
         */
        public bool insertCoopeartion(Cooperation cp)
        {
            cooperation c = new cooperation();

            if (cp != null)
            {
                c.mark      = cp.mark;
                c.announcer = cp.announcer;
                c.data      = cp.data;
                db.cooperation.InsertOnSubmit(c);
                db.SubmitChanges();
                return(true);
            }
            return(false);
        }
Пример #10
0
        /// <summary>
        /// 获取对应客户是否有存在待审核的企业试吃数据
        /// </summary>
        /// <returns></returns>
        public Cooperation FindByCustomerId(string customerId)
        {
            var query = base.DAL.Table <Cooperation>().Where(c => c.Status == 0 && c.CustomerId == customerId).OrderByDescending(c => c.CreatedOn);
            var data  = query.FirstOrDefault();

            if (data == null)
            {
                data = new Cooperation()
                {
                    CustomerId = customerId,
                    Status     = 0
                };
            }
            return(data);
        }
Пример #11
0
    //战斗队列角色增加了,让这个角色获得羁绊
    void OnAddFight(RoleBase role)
    {
        if (role == null)
        {
            return;
        }
        else
        {
            Cooperation etl1 = GetPlayerCooper(role.GetCooperId());
            Profession  etl2 = GetPlayerPro(role.GetProId());

            etl1.AddUpdate(playerModel.fightRoles, role);
            etl2.AddUpdate(playerModel.fightRoles, role);

            EventManager.ExecuteEvent(EventType.EtlDataUpdate);
        }
    }
Пример #12
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Cooperation item = new Cooperation();

            item.ShopName = txtshopname.Value;
            item.UserName = txtusername.Value;
            item.Phone    = txtphone.Value;
            item.Address  = txtaddress.Value;

            if (new CooperationBLL().AddItem(item) > 0)
            {
                Utils.alert("提交成功!", "busecooperation.aspx");
            }
            else
            {
                Utils.alert("提交失败!", "busecooperation.aspx");
            }
        }
Пример #13
0
        private void btnAddCooperation_Click(object sender, RoutedEventArgs e)
        {
            object o = PopUpAddCooperation.ShowPopUp(GameObject.GetInstance().HumanAirline, this.Airport.Airport);

            if (o != null && o is CooperationType)
            {
                CooperationType type = (CooperationType)o;

                if (type.Price < GameObject.GetInstance().HumanAirline.Money)
                {
                    Cooperation cooperation = new Cooperation(type, GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime);

                    this.Airport.addCooperation(cooperation);
                }
                else
                {
                    WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2232"), string.Format(Translator.GetInstance().GetString("MessageBox", "2232", "message")), WPFMessageBoxButtons.Ok);
                }
            }
        }
Пример #14
0
        public ActionResult SubmitCooperation(Cooperation entity)
        {
            var result = new OpResult();

            //result.Successed = false;
            //string par = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
            //Regex regex = new Regex(par);
            //Match match = regex.Match(entity.Email);
            //if (!match.Success)
            //{
            //    result.Message = "请输入正确的邮箱";
            //    return new JsonNetResult(result);
            //}
            //if (new Regex(@"^1[3|5|7|8|][0-9]{9}$").IsMatch(entity.Phone) == false)
            //{
            //    result.Message = "请输入正确的手机号!";
            //    return new JsonNetResult(result);
            //}
            result = new CooperationService().SubmitCooperation(entity, CurrentMember.MemberId.ToString());
            return(new JsonNetResult(result));
        }
Пример #15
0
        public static List <Cooperation> GetList(int pageindex, int pagesize)
        {
            List <Cooperation> list   = new List <Cooperation>();
            string             spName = "cudo_getcooperationlist";

            SqlParameter[] paramvalues = new SqlParameter[]
            {
                new SqlParameter("@pageindex", pageindex),
                new SqlParameter("@pagesize", pagesize)
            };
            SqlDataReader dataReader = SqlHelper.ExecuteReader(SqlHelper.ConnectionString, CommandType.StoredProcedure, spName, paramvalues);

            try
            {
                while (dataReader.Read())
                {
                    Cooperation item = new Cooperation();
                    item.Id       = Convert.ToInt32(dataReader["id"]);
                    item.ShopName = dataReader["shopname"].ToString();
                    item.UserName = dataReader["username"].ToString();
                    item.Phone    = dataReader["phone"].ToString();
                    item.Address  = dataReader["address"].ToString();
                    item.AddTime  = Convert.ToDateTime(dataReader["addtime"]);
                    list.Add(item);
                }
            }
            catch
            {
                dataReader.Close();
                dataReader.Dispose();
            }
            finally
            {
                dataReader.Close();
                dataReader.Dispose();
            }
            return(list);
        }
Пример #16
0
 //adds a cooperation to the airport
 public void addCooperation(Cooperation cooperation)
 {
     this.Cooperations.Add(cooperation);
 }
Пример #17
0
 //removes a cooperation from the airport
 public void removeCooperation(Cooperation cooperation)
 {
     this.Cooperations.Remove(cooperation);
 }
Пример #18
0
 //removes a cooperation from the airport
 public void removeCooperation(Cooperation cooperation)
 {
     this.Cooperations.Remove(cooperation);
     this.Airport.removeCooperation(cooperation);
 }
Пример #19
0
        public ActionResult SubmitCooperation(Cooperation entity)
        {
            var result = cs.SubmitCooperation(entity);

            return(Json(result));
        }
Пример #20
0
        /// <summary>
        /// 提交合作公司信息
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public OpResult SubmitCooperation(Cooperation entity, string currentUserId)
        {
            OpResult result    = null;
            var      newEntity = entity;

            if (entity.CompanyName == null || entity.CompanyName.Trim() == "")
            {
                return result = new OpResult()
                {
                           Successed = false, Message = "请填写您的公司名称!"
                }
            }
            ;
            if (entity.CompanyAddress == null || entity.CompanyAddress.Trim() == "")
            {
                return result = new OpResult()
                {
                           Successed = false, Message = "请填写您的公司地址!"
                }
            }
            ;
            if (entity.Phone == null || entity.Phone.Trim() == "")
            {
                return result = new OpResult()
                {
                           Successed = false, Message = "请填写您的联系电话!"
                }
            }
            ;
            if (entity.Email.Trim() == null)
            {
                return(result = new OpResult()
                {
                    Successed = false, Message = "邮箱信息不能为空!"
                });
            }
            if (entity.Phone.Trim() == null)
            {
                return(result = new OpResult()
                {
                    Successed = false, Message = "电话号码不能为空!"
                });
            }
            string par   = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
            Regex  regex = new Regex(par);
            Match  match = regex.Match(entity.Email);

            if (!match.Success)
            {
                return(result = new OpResult()
                {
                    Successed = false, Message = "请输入正确的邮箱!"
                });
            }
            if (new Regex(@"^1[3|5|7|8|][0-9]{9}$").IsMatch(entity.Phone) == false)
            {
                return(result = new OpResult()
                {
                    Successed = false, Message = "请输入正确的手机号!"
                });
            }
            var data = context.Cooperations.Where(c => c.IsDeleted != 1 && c.CompanyName.Equals(entity.CompanyName) && c.CustomerId.Equals(currentUserId)).FirstOrDefault();

            if (data == null)
            {//add
                var temp = context.Cooperations.Where(p => p.IsDeleted != 1 && p.CustomerId.Equals(currentUserId) && (p.CompanyAddress.Equals(entity.CompanyAddress) || p.CompanyName.Equals(entity.CompanyName))).ToList();
                if (temp.Count == 0)
                {
                    newEntity.Id           = Guid.NewGuid().ToString("N");
                    newEntity.CreatedOn    = DateTime.Now;
                    newEntity.ApplyForTime = DateTime.Now;
                    newEntity.CustomerId   = currentUserId;
                    newEntity.Status       = 0;
                    context.Cooperations.Add(newEntity);
                    context.SaveChanges();
                    result = new OpResult()
                    {
                        Successed = true, Message = "请等待我们与您联系!"
                    };
                }
                else
                {
                    result = new OpResult()
                    {
                        Successed = true, Message = "该企业已经试吃过了!"
                    }
                };
            }
            else
            {//update
                if (data.Status == 0)
                {
                    data.ModifiedBy        = currentUserId;
                    data.ModifiedOn        = DateTime.Now;
                    data.Status            = 0;
                    data.CompanyName       = entity.CompanyName;
                    data.CompanyAddress    = entity.CompanyAddress;
                    data.CompanyPopulation = entity.CompanyPopulation;
                    data.Name  = entity.Name;
                    data.Phone = entity.Phone;
                    data.Email = entity.Email;
                    context.SaveChanges();
                    result = new OpResult()
                    {
                        Successed = true, Message = "试吃申请修改成功!"
                    };
                }
                else
                {
                    result = new OpResult()
                    {
                        Successed = true, Message = "该试吃记录已审核过!"
                    }
                };
            }
            return(result);
        }
Пример #21
0
 public int AddItem(Cooperation item)
 {
     return(CooperationDAL.AddItem(item));
 }
Пример #22
0
        public JsonResult InviteNewTeamMember(InviteRequest request)
        {
            var checkUsernameResult = CheckUsername(request.username);

            if (checkUsernameResult != null)
            {
                return(checkUsernameResult);
            }

            if (!CornerCaseCheckHelper.Check(request.inviteName, 50, CornerCaseCheckHelper.Username))
            {
                return(JsonReturnHelper.ErrorReturn(108, "Invalid inviteName"));
            }

            if (!CornerCaseCheckHelper.Check(request.teamId, 0, CornerCaseCheckHelper.Id))
            {
                return(JsonReturnHelper.ErrorReturn(301, "Invalid teamId"));
            }

            var team = _meshContext.Teams.FirstOrDefault(t => t.Id == request.teamId);

            if (team == null)
            {
                return(JsonReturnHelper.ErrorReturn(302, "Team not exist."));
            }

            if (_permissionCheck.CheckTeamPermission(request.username, team) != PermissionCheckHelper.TeamAdmin)
            {
                return(JsonReturnHelper.ErrorReturn(305, "Permission denied."));
            }

            var inviteUser = _meshContext.Users.FirstOrDefault(u => u.Email == request.inviteName);

            if (inviteUser == null)
            {
                return(JsonReturnHelper.ErrorReturn(108, "Username or inviteName not exists."));
            }

            if (_permissionCheck.CheckTeamPermission(request.inviteName, team) != PermissionCheckHelper.TeamOutsider)
            {
                return(JsonReturnHelper.ErrorReturn(306, "User already in team."));
            }

            var cooperation = new Cooperation()
            {
                TeamId = request.teamId,
                UserId = inviteUser.Id
            };

            try
            {
                _meshContext.Cooperations.Add(cooperation);
                _meshContext.SaveChanges();
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                return(JsonReturnHelper.ErrorReturn(1, "Unexpected error."));
            }

            return(JsonReturnHelper.SuccessReturn());
        }