コード例 #1
0
        public void BzWc(TransferEntity entity)
        {
            WebClient wc = new WebClient();

            wc.Credentials = CredentialCache.DefaultCredentials;
            try
            {
                BxwcTransfer bt = new BxwcTransfer();
                bt.RoleDutyId   = entity.InPostId;
                bt.RoleDutyName = entity.InPostName;
                bt.id           = entity.TID;
                bt.quarters     = entity.OutJobName;
                bt.quartersid   = entity.OutJobId;
                BzBase bs = new BzBase();
                bs.data   = bt;
                bs.userId = OperatorProvider.Provider.Current().UserId;
                //如果是待审批状态 则同步到班组那边
                System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection();
                nc.Add("json", Newtonsoft.Json.JsonConvert.SerializeObject(bs));
                wc.UploadValuesCompleted += wc_UploadValuesCompleted;
                wc.UploadValuesAsync(new Uri(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/updatetoerchtms"), nc);
            }
            catch (Exception e)
            {
            }
        }
コード例 #2
0
        /// <summary>
        /// 转岗同步
        /// </summary>
        private void SyZg(TransferEntity entity, bool i)
        {
            WebClient wc = new WebClient();

            wc.Credentials = CredentialCache.DefaultCredentials;
            try
            {
                BzAppTransfer tr = new BzAppTransfer();
                tr.Id              = entity.TID;
                tr.RoleDutyId      = entity.OutPostId;
                tr.RoleDutyName    = entity.OutPostName;
                tr.allocationtime  = Convert.ToDateTime(entity.TransferTime).ToString("yyyy-MM-dd");
                tr.department      = entity.OutDeptName;
                tr.departmentid    = entity.OutDeptId;
                tr.iscomplete      = i;
                tr.leaveremark     = "";
                tr.leavetime       = "";
                tr.oldRoleDutyName = entity.InPostName;
                tr.olddepartment   = entity.InDeptName;
                tr.olddepartmentid = entity.InDeptId;
                tr.oldquarters     = entity.InJobName;
                tr.quarters        = entity.OutJobName;
                tr.quartersid      = entity.OutJobId;
                tr.userId          = entity.UserId;
                tr.username        = entity.UserName;


                BzBase bs = new BzBase();
                bs.data   = tr;
                bs.userId = OperatorProvider.Provider.Current().UserId;

                string        Json      = "json=" + bs.ToJson();
                string        massge    = HttpMethods.HttpPost(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/OperationEntity", Json);
                AppInTransfer appreturn = JsonConvert.DeserializeObject <AppInTransfer>(massge);
                if (appreturn.code == "0")
                {
                    if (i)
                    {
                        BzWc(entity);
                    }
                }
                ////如果是待审批状态 则同步到班组那边
                //System.Collections.Specialized.NameValueCollection nc = new System.Collections.Specialized.NameValueCollection();
                //nc.Add("json", Newtonsoft.Json.JsonConvert.SerializeObject(bs));
                //wc.UploadValuesCompleted += wc_UploadValuesCompleted;
                //wc.UploadValuesAsync(new Uri(new DataItemDetailBLL().GetItemValue("yjbzUrl") + "/UserWorkAllocation/OperationEntity"), nc);
            }
            catch (Exception e)
            {
            }
        }