Beispiel #1
0
        private async Task <bool> UpdateStaff()
        {
            var success = true;
            await ServiceProxyFactory.LifeTime(async factory =>
            {
                StaffResult saveResult = null;
                Staff staff            = new Staff();
                staff.CompanyId        = CompanyId;
                staff.Code             = txtStaffCode.Text;
                staff.Name             = txtStaffName.Text.Trim();
                staff.DepartmentId     = DeparmentId;
                staff.Mail             = txtStaffMail.Text.Trim();
                staff.Tel            = txtStaffTel.Text.Trim();
                staff.Fax            = txtStaffFax.Text.Trim();
                staff.UpdateBy       = Login.UserId;
                staff.UpdateAt       = DateTime.Now;
                staff.CreateBy       = Login.UserId;
                staff.CreateAt       = DateTime.Now;
                staff.Id             = StaffId;
                staff.DepartmentCode = txtDepartmentCode.Text;
                staff.DepartmentName = lblDepartmentName.Text;

                var service = factory.Create <StaffMasterClient>();
                saveResult  = await service.SaveAsync(SessionKey, staff);

                success        = saveResult?.ProcessResult.Result ?? false;
                var syncResult = true;
                if (SavePostProcessor != null && success)
                {
                    syncResult = SavePostProcessor.Invoke(new IMasterData[] { saveResult.Staff as IMasterData });
                }
                success &= syncResult;

                if (success)
                {
                    await LoadStaffGrid();
                }
            });

            return(success);
        }
 public StaffResult getOneStaffDataBase(string sID)
 {
     StaffDataBase sDB = new StaffDataBase();
     sDB.personnelFunction();
     StaffResult returnValue = new StaffResult();
     if (int.Parse(sDB._StaffhaveRoles[3]) == 1)
     {
         returnValue=sDB.getOneStaffDataBase(sID);
     }
     else
     {
         returnValue.checkNo = _noRole;
         returnValue.errorMsg = _errorMsg;
     }
     List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
     if (returnValue.StaffBaseData.unit != UserFile[2] && int.Parse(sDB._StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
     {
         returnValue.checkNo = _getcheckNo;
         returnValue.errorMsg = _errorMsg;
     }
     return returnValue;
 }
    public StaffResult getOneStaffDataBase(string ID)
    {
        StaffResult returnValue = new StaffResult();
        returnValue.StaffBaseData = new CreateStaff();
        returnValue.WorkData = new List<staffWorkData>();
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = "SELECT * FROM StaffDatabase WHERE isDeleted=0 AND ID=(@ID)";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Int64.Parse(ID);
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    CreateStaff addValue1 = new CreateStaff();
                    addValue1.FamilyStatu = new List<string[]>();
                    addValue1.SpecialtySkill = new List<string[]>();

                    returnValue.ID = Int64.Parse(dr["ID"].ToString());
                    addValue1.unit = dr["Unit"].ToString();
                    addValue1.staffID = dr["StaffID"].ToString();
                    addValue1.staffName = dr["StaffName"].ToString();
                    addValue1.officeDate = DateTime.Parse(dr["AppointmentDate"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.resignDate = DateTime.Parse(dr["ResignationDate"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.applyJob = dr["WorkItem"].ToString();
                    addValue1.jobTitle = dr["JobCapacity"].ToString();
                    addValue1.jobLevel = dr["JobGrade"].ToString();
                    addValue1.staffTWID = dr["StaffIdentity"].ToString();
                    addValue1.staffPhoto = dr["StaffAvatar"].ToString();
                    addValue1.comeCity = dr["Hometown"].ToString();
                    addValue1.staffbirthday = DateTime.Parse(dr["Birthday"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.staffsex = dr["sex"].ToString();
                    addValue1.marriage = dr["Marriage"].ToString();
                    addValue1.censusAddress = dr["AddressOther1"].ToString();
                    addValue1.censusAddressZip = dr["AddressZip1"].ToString();
                    addValue1.censusCity = dr["AddressCity1"].ToString();
                    addValue1.address = dr["AddressOther2"].ToString();
                    addValue1.addressCity = dr["AddressCity2"].ToString();
                    addValue1.addressZip = dr["AddressZip2"].ToString();
                    addValue1.TDaytime = dr["TelDaytime"].ToString();
                    addValue1.TNight = dr["TelNight"].ToString();
                    addValue1.Phone = dr["Phone"].ToString();
                    addValue1.staffemail = dr["Email"].ToString();
                    addValue1.EmergencyName = dr["UrgentContactName"].ToString();
                    addValue1.EmergencyAddress = dr["UrgentContactAddress"].ToString();
                    addValue1.EmergencyPhone = dr["UrgentContactTel"].ToString();
                    addValue1.DSchoolName = dr["DoctorSchoolName"].ToString();
                    addValue1.DDepartment = dr["DoctorDepartment"].ToString();
                    addValue1.DSince = dr["DoctorSince"].ToString();
                    addValue1.DUntil = dr["DoctorUntil"].ToString();
                    addValue1.study1 = dr["DoctorState"].ToString();
                    addValue1.MSchoolName = dr["MasterSchoolName"].ToString();
                    addValue1.MDepartment = dr["MasterDepartment"].ToString();
                    addValue1.MSince = dr["MasterSince"].ToString();
                    addValue1.MUntil = dr["MasterUntil"].ToString();
                    addValue1.study2 = dr["MasterState"].ToString();
                    addValue1.USchoolName = dr["UniversitySchoolName"].ToString();
                    addValue1.UDepartment = dr["UniversityDepartment"].ToString();
                    addValue1.USince = dr["UniversitySince"].ToString();
                    addValue1.UUntil = dr["UniversityUntil"].ToString();
                    addValue1.study3 = dr["UniversityState"].ToString();
                    addValue1.VSchoolName = dr["VocationalSchoolName"].ToString();
                    addValue1.VDepartment = dr["VocationalDepartment"].ToString();
                    addValue1.VSince = dr["VocationalSince"].ToString();
                    addValue1.VUntil = dr["VocationalUntil"].ToString();
                    addValue1.study4 = dr["VocationalState"].ToString();
                    addValue1.JDateSince1 = dr["Experience1Since"].ToString();
                    addValue1.JDateUntil1 = dr["Experience1Until"].ToString();
                    addValue1.JCname1 = dr["Experience1Company"].ToString();
                    addValue1.Jposition1 = dr["Experience1Post"].ToString();
                    addValue1.Jsalary1 = dr["Experience1Salary"].ToString();
                    addValue1.prove1 = dr["Experience1Prove"].ToString();
                    addValue1.JTitle1 = dr["Experience1Director"].ToString();
                    addValue1.JTitleName1 = dr["Experience1DirectorName"].ToString();
                    addValue1.JDateSince2 = dr["Experience2Since"].ToString();
                    addValue1.JDateUntil2 = dr["Experience2Until"].ToString();
                    addValue1.JCname2 = dr["Experience2Company"].ToString();
                    addValue1.Jposition2 = dr["Experience2Post"].ToString();
                    addValue1.Jsalary2 = dr["Experience2Salary"].ToString();
                    addValue1.prove2 = dr["Experience2Prove"].ToString();
                    addValue1.JTitle2 = dr["Experience2Director"].ToString();
                    addValue1.JTitleName2 = dr["Experience2DirectorName"].ToString();
                    addValue1.JDateSince3 = dr["Experience3Since"].ToString();
                    addValue1.JDateUntil3 = dr["Experience3Until"].ToString();
                    addValue1.JCname3 = dr["Experience3Company"].ToString();
                    addValue1.Jposition3 = dr["Experience3Post"].ToString();
                    addValue1.Jsalary3 = dr["Experience3Salary"].ToString();
                    addValue1.prove3 = dr["Experience3Prove"].ToString();
                    addValue1.JTitle3 = dr["Experience3Director"].ToString();
                    addValue1.JTitleName3 = dr["Experience3DirectorName"].ToString();
                    addValue1.JDateSince4 = dr["Experience4Since"].ToString();
                    addValue1.JDateUntil4 = dr["Experience4Until"].ToString();
                    addValue1.JCname4 = dr["Experience4Company"].ToString();
                    addValue1.Jposition4 = dr["Experience4Post"].ToString();
                    addValue1.Jsalary4 = dr["Experience4Salary"].ToString();
                    addValue1.prove4 = dr["Experience4Prove"].ToString();
                    addValue1.JTitle4 = dr["Experience4Director"].ToString();
                    addValue1.JTitleName4 = dr["Experience4DirectorName"].ToString();

                    for (int i = 1; i <= 6; i++)
                    {
                        string[] Familyitem = new string[4];
                        Familyitem[0] = dr["Family" + i + "Title"].ToString();
                        Familyitem[1] = dr["Family" + i + "Name"].ToString();
                        Familyitem[2] = dr["Family" + i + "Age"].ToString();
                        Familyitem[3] = dr["Family" + i + "Profession"].ToString();
                        addValue1.FamilyStatu.Add(Familyitem);
                    }
                    addValue1.bailName = dr["GuarantorName"].ToString();
                    addValue1.bailUnit = dr["GuarantorUnit"].ToString();
                    addValue1.bailJob = dr["GuarantorPost"].ToString();
                    addValue1.bailRelationship = dr["GuarantorRelationship"].ToString();
                    addValue1.bailContact = dr["GuarantorContact"].ToString();
                    addValue1.bailContactTime = dr["GuarantorContactTime"].ToString();
                    addValue1.recruited = dr["CandidatesMessage"].ToString();
                    addValue1.recruitedText = dr["MessageExplain"].ToString();
                    addValue1.langAbility1 = dr["Language1Name"].ToString();
                    addValue1.langL1 = dr["Language1Listen"].ToString();
                    addValue1.langS1 = dr["Language1Say"].ToString();
                    addValue1.langR1 = dr["Language1Read"].ToString();
                    addValue1.langW1 = dr["Language1Write"].ToString();
                    addValue1.langAbility2 = dr["Language2Name"].ToString();
                    addValue1.langL2 = dr["Language2Listen"].ToString();
                    addValue1.langS2 = dr["Language2Say"].ToString();
                    addValue1.langR2 = dr["Language2Read"].ToString();
                    addValue1.langW2 = dr["Language2Write"].ToString();
                    addValue1.langAbility3 = dr["Language3Name"].ToString();
                    addValue1.langL3 = dr["Language3Listen"].ToString();
                    addValue1.langS3 = dr["Language3Say"].ToString();
                    addValue1.langR3 = dr["Language3Read"].ToString();
                    addValue1.langW3 = dr["Language3Write"].ToString();

                    for (int i = 1; i <= 4; i++)
                    {
                        string[] SpecialtySkillitem = new string[6];
                        SpecialtySkillitem[0] = dr["ExpertiseSkill" + i].ToString();
                        SpecialtySkillitem[1] = dr["ExpertiseSkill" + i + "License"].ToString();
                        SpecialtySkillitem[2] = dr["ExpertiseSkill" + i + "Progression"].ToString();
                        SpecialtySkillitem[3] = dr["ExpertiseSkill" + i + "GetUnit"].ToString();
                        SpecialtySkillitem[4] = DateTime.Parse(dr["ExpertiseSkill" + i + "GetDate"].ToString()).ToString("yyyy-MM-dd");
                        SpecialtySkillitem[5] = DateTime.Parse(dr["ExpertiseSkill" + i + "ValidDate"].ToString()).ToString("yyyy-MM-dd");
                        addValue1.SpecialtySkill.Add(SpecialtySkillitem);
                    }

                    addValue1.disease = dr["Disease"].ToString();
                    addValue1.diseaseText = dr["DiseaseExplain"].ToString();
                    addValue1.fillInDate = DateTime.Parse(dr["FileDate"].ToString()).ToString("yyyy-MM-dd");

                    addValue1.TrialStart = DateTime.Parse(dr["TrialStart"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.TrialEnd = DateTime.Parse(dr["TrialEnd"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.DealStart = DateTime.Parse(dr["DealStart"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.DealEnd = DateTime.Parse(dr["DealEnd"].ToString()).ToString("yyyy-MM-dd");
                    addValue1.CardNum = dr["CardNum"].ToString();

                    returnValue.StaffBaseData = addValue1;

                    returnValue.WorkData = this.GetStaffWorkData(dr["StaffID"].ToString());
                }
                dr.Close();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue.checkNo = "-1";
                returnValue.errorMsg = e.Message;
            }

        }
        return returnValue;
    }