Exemple #1
0
        protected override void Execute(CodeActivityContext context)
        {
            usecarapplyform Applyinfo = new usecarapplyform();
            Applyinfo.ApplyUserName = request.Get(context).ApplyUserName;
            Applyinfo.usecartype = new YunShanOA.BusinessLogic.UseCar.UseTypeManager().GetUsecarType(request.Get(context).usecartypeID);
            Applyinfo.WFID = context.WorkflowInstanceId;

            List<YunShanOA.Model.UseCarModel.usecaranduser> results = new List<usecaranduser>();
            foreach (usecaranduser user in request.Get(context).Usecaranduser)
            {
                usecaranduser usecaranduser = new usecaranduser();
                usecaranduser.Name = user.Name;
                usecaranduser.Email = user.Email;
                results.Add(usecaranduser);
            }
            Applyinfo.Usecaranduser = results;
            Applyinfo.BeginTime = request.Get(context).BeginTime;
            Applyinfo.EndTime = request.Get(context).EndTime;
            Applyinfo.StartDestination = request.Get(context).StartDestination;
            Applyinfo.EndDestination = request.Get(context).EndDestination;
            Applyinfo.ApplyStatus = 2;
            Applyinfo.ApplyReason = request.Get(context).ApplyReason;
            Applyinfo.Comment = request.Get(context).Comment;
            BusinessLogic.UseCar.UsecarApplyformManager ApplyformManager = new UsecarApplyformManager();
            int i = ApplyformManager.Sava(Applyinfo);
            List<usecaranduser> s = new List<usecaranduser>();
            s = new YunShanOA.BusinessLogic.UseCar.UsecarAndUserManager().GetCarAndUserlistByFormID(Applyinfo.UseCarApplyFormID);
            Applyinfo.Usecaranduser = s;
            Applyinfo.UseCarApplyFormID = i;
            Apply.Set(context, Applyinfo);
            // 获取 Text 输入参数的运行时值
        }
 public int Save(usecaranduser myusecaranduser)
 {
     if (myusecaranduser != null)
     {
         return dal.Save(myusecaranduser);
     }
     return -1;
 }
Exemple #3
0
        private List <usecaranduser> CollectUser()
        {
            List <YunShanOA.Model.UseCarModel.usecaranduser> users = new List <Model.UseCarModel.usecaranduser>();

            foreach (object tmp in this.SelectedItems)
            {
                YunShanOA.Model.UseCarModel.usecaranduser user = new YunShanOA.Model.UseCarModel.usecaranduser();

                string[] s = tmp.ToString().Split('|');
                user.Name  = s[0];
                user.Email = s[1];
                users.Add(user);
            }
            return(users);
        }
        public int Save(usecaranduser myusecaranduser)
        {
            UseCarAndUser u;
            bool found = false;
            if (-1 == myusecaranduser.UseCarUserId)
            {
                u = new UseCarAndUser();
                db.UseCarAndUser.InsertOnSubmit(u);
                found = true;
            }
            else
            {
                u = (from UseCarAndUsers in db.UseCarAndUser where UseCarAndUsers.UseCarUserId == myusecaranduser.UseCarUserId select UseCarAndUsers).FirstOrDefault();
                if (u != null)
                {
                    found = true;
                    int id = (int)myusecaranduser.UseCarUserId;
                    u.UseCarUserId = id;
                }
            }
            if (found)
            {
                u.UseCarUserId = myusecaranduser.UseCarUserId;
                u.UseCarApplyFormID = myusecaranduser.UseCarApplyFormID;
                u.Name = myusecaranduser.Name;
                u.Email = myusecaranduser.Email;
                try
                {
                    db.SubmitChanges();

                }
                catch (ChangeConflictException)
                {
                    db.ChangeConflicts.ResolveAll(RefreshMode.OverwriteCurrentValues);
                    db.SubmitChanges();
                }
                return u.UseCarUserId;
            }
            else
            {
                return -1;
            }
        }
 private usecaranduser FillRecord(UseCarAndUser i)
 {
     usecaranduser usecaranduser = null;
     if (i != null)
     {
         usecaranduser = new usecaranduser();
         usecaranduser.UseCarUserId = i.UseCarUserId;
         usecaranduser.UseCarApplyFormID = i.UseCarApplyFormID;
         usecaranduser.Name = i.Name;
         usecaranduser.Email = i.Email;
     }
     return usecaranduser;
 }
        private List<usecaranduser> CollectUser()
        {
            List<YunShanOA.Model.UseCarModel.usecaranduser> users = new List<Model.UseCarModel.usecaranduser>();

            foreach (object tmp in this.SelectedItems)
            {
                YunShanOA.Model.UseCarModel.usecaranduser user = new YunShanOA.Model.UseCarModel.usecaranduser();

                string[] s = tmp.ToString().Split('|');
                user.Name = s[0];
                user.Email = s[1];
                users.Add(user);
            }
            return users;
        }