public async Task <IActionResult> Create(CreateStaff m)//add view=>Empty tem
        {
            if (ModelState.IsValid)
            {
                // get new user info
                var user = new IdentityUser {
                    UserName = m.Email, Email = m.Email, PhoneNumber = m.Phone
                };
                //set user with passwad
                var result = await _userManager.CreateAsync(user, m.Password);

                if (result.Succeeded)
                {
                    //add role
                    await _userManager.AddToRoleAsync(user, "Staff");

                    //add to staff
                    var staff = new BeanSeans.Data.Staff
                    {
                        FirstName    = m.FirstName,
                        LastName     = m.LastName,
                        UserId       = user.Id,
                        Email        = m.Email,
                        RestuarantId = 1,
                        Phone        = m.Phone
                    };


                    _db.Staffs.Add(staff);
                    await _db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }



            return(View(m));
        }
Beispiel #2
0
 public RedirectToPageResult OnPost(CreateStaff command)
 {
     _staffApplication.Create(command);
     return(RedirectToPage("./Index"));
 }
 public string[] setCreateUserMemberPhotoData(CreateStaff StaffData)
 {
     StaffDataBase sDB = new StaffDataBase();
     return sDB.setCreateUserMemberPhotoData(StaffData);
 }
 public int UpOneStaffDataBase(CreateStaff StaffData)
 {
     StaffDataBase sDB = new StaffDataBase();
     return sDB.UpOneStaffDataBase(StaffData);
 }
    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;
    }
    public string[] CreateUserMemberData(CreateStaff StaffData)
    {
        string[] returnValue = new string[3];
            returnValue[0] = "0";
            returnValue[1] = "0";
            returnValue[2] = "0";
            DataBase Base = new DataBase();
            using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
            {
                try
                {
                    List<string> CreateFileName = this.getStaffDataName(HttpContext.Current.User.Identity.Name);
                    Sqlconn.Open();
                    string sql = "INSERT INTO StaffDatabase (Unit, StaffID, StaffName, AppointmentDate, ResignationDate, WorkItem, JobCapacity, JobGrade, StaffIdentity, " +
                        "StaffAvatar, Hometown, Birthday, sex, Marriage, AddressZip1, AddressCity1, AddressOther1, AddressZip2, AddressCity2, AddressOther2, TelDaytime, "+
                        "TelNight, Phone, Email, " +
                        "UrgentContactName, UrgentContactAddress, UrgentContactTel, DoctorSchoolName, DoctorDepartment, DoctorSince, DoctorUntil, DoctorState, MasterSchoolName, " +
                        "MasterDepartment, MasterSince, MasterUntil, MasterState, UniversitySchoolName, UniversityDepartment, UniversitySince, UniversityUntil, UniversityState, " +
                        "VocationalSchoolName, VocationalDepartment, VocationalSince, VocationalUntil, VocationalState, Experience1Since, Experience1Until, Experience1Company, " +
                        "Experience1Post, Experience1Salary, Experience1Prove, Experience1Director, Experience1DirectorName, Experience2Since, Experience2Until, " +
                        "Experience2Company, Experience2Post, Experience2Salary, Experience2Prove, Experience2Director, Experience2DirectorName, Experience3Since, " +
                        "Experience3Until, Experience3Company, Experience3Post, Experience3Salary, Experience3Prove, Experience3Director, Experience3DirectorName, " +
                        "Experience4Since, Experience4Until, Experience4Company, Experience4Post, Experience4Salary, Experience4Prove, Experience4Director, " +
                        "Experience4DirectorName, Family1Title, Family1Name, Family1Age, Family1Profession, Family2Title, Family2Name, Family2Age, Family2Profession, " +
                        "Family3Title, Family3Name, Family3Age, Family3Profession, Family4Title, Family4Name, Family4Age, Family4Profession, Family5Title, " +
                        "Family5Name, Family5Age, Family5Profession, Family6Title, Family6Name, Family6Age, Family6Profession, GuarantorName, GuarantorUnit, " +
                        "GuarantorPost, GuarantorRelationship, GuarantorContact, GuarantorContactTime, CandidatesMessage, MessageExplain, Language1Name, Language1Listen, " +
                        "Language1Say, Language1Read, Language1Write, Language2Name, Language2Listen, Language2Say, Language2Read, Language2Write, Language3Name, " +
                        "Language3Listen, Language3Say, Language3Read, Language3Write, ExpertiseSkill1, ExpertiseSkill1License, ExpertiseSkill1Progression, " +
                        "ExpertiseSkill1GetUnit, ExpertiseSkill1GetDate, ExpertiseSkill1ValidDate, ExpertiseSkill2, ExpertiseSkill2License, ExpertiseSkill2Progression, " +
                        "ExpertiseSkill2GetUnit, ExpertiseSkill2GetDate, ExpertiseSkill2ValidDate, ExpertiseSkill3, ExpertiseSkill3License, ExpertiseSkill3Progression, " +
                        "ExpertiseSkill3GetUnit, ExpertiseSkill3GetDate, ExpertiseSkill3ValidDate, ExpertiseSkill4, ExpertiseSkill4License, ExpertiseSkill4Progression, " +
                        "TrialStart,TrialEnd,DealStart,DealEnd,CardNum," + //by WHO
                        "ExpertiseSkill4GetUnit, ExpertiseSkill4GetDate, ExpertiseSkill4ValidDate, Disease, DiseaseExplain, FileDate, CreateFileBy, UpFileBy, UpFileDate)" +

                        "VALUES (@Unit, @StaffID, @StaffName, @AppointmentDate, @ResignationDate, @WorkItem, @JobCapacity, @JobGrade, @StaffIdentity, " +
                        "@StaffAvatar, @Hometown, @Birthday, @sex, @Marriage, @AddressZip1, @AddressCity1, " +
                        "@AddressOther1, @AddressZip2, @AddressCity2, @AddressOther2, @TelDaytime, @TelNight, @Phone, @Email, " +
                        "@UrgentContactName, @UrgentContactAddress, @UrgentContactTel, @DoctorSchoolName, @DoctorDepartment, @DoctorSince, @DoctorUntil, @DoctorState, @MasterSchoolName, " +
                        "@MasterDepartment, @MasterSince, @MasterUntil, @MasterState, @UniversitySchoolName, @UniversityDepartment, @UniversitySince, @UniversityUntil, @UniversityState, " +
                        "@VocationalSchoolName, @VocationalDepartment, @VocationalSince, @VocationalUntil, @VocationalState, @Experience1Since, @Experience1Until, @Experience1Company, " +
                        "@Experience1Post, @Experience1Salary, @Experience1Prove, @Experience1Director, @Experience1DirectorName, @Experience2Since, @Experience2Until, " +
                        "@Experience2Company, @Experience2Post, @Experience2Salary, @Experience2Prove, @Experience2Director, @Experience2DirectorName, @Experience3Since, " +
                        "@Experience3Until, @Experience3Company, @Experience3Post, @Experience3Salary, @Experience3Prove, @Experience3Director, @Experience3DirectorName, " +
                        "@Experience4Since, @Experience4Until, @Experience4Company, @Experience4Post, @Experience4Salary, @Experience4Prove, @Experience4Director, " +
                        "@Experience4DirectorName, @Family1Title, @Family1Name, @Family1Age, @Family1Profession, @Family2Title, @Family2Name, @Family2Age, @Family2Profession, " +
                        "@Family3Title, @Family3Name, @Family3Age, @Family3Profession, @Family4Title, @Family4Name, @Family4Age, @Family4Profession, @Family5Title, " +
                        "@Family5Name, @Family5Age, @Family5Profession, @Family6Title, @Family6Name, @Family6Age, @Family6Profession, @GuarantorName, @GuarantorUnit, " +
                        "@GuarantorPost, @GuarantorRelationship, @GuarantorContact, @GuarantorContactTime, @CandidatesMessage, @MessageExplain, @Language1Name, @Language1Listen, " +
                        "@Language1Say, @Language1Read, @Language1Write, @Language2Name, @Language2Listen, @Language2Say, @Language2Read, @Language2Write, @Language3Name, " +
                        "@Language3Listen, @Language3Say, @Language3Read, @Language3Write, @ExpertiseSkill1, @ExpertiseSkill1License, @ExpertiseSkill1Progression, " +
                        "@ExpertiseSkill1GetUnit, @ExpertiseSkill1GetDate, @ExpertiseSkill1ValidDate, @ExpertiseSkill2, @ExpertiseSkill2License, @ExpertiseSkill2Progression, " +
                        "@ExpertiseSkill2GetUnit, @ExpertiseSkill2GetDate, @ExpertiseSkill2ValidDate, @ExpertiseSkill3, @ExpertiseSkill3License, @ExpertiseSkill3Progression, " +
                        "@ExpertiseSkill3GetUnit, @ExpertiseSkill3GetDate, @ExpertiseSkill3ValidDate, @ExpertiseSkill4, @ExpertiseSkill4License, @ExpertiseSkill4Progression, " +
                        "@TrialStart,@TrialEnd,@DealStart,@DealEnd,@CardNum," + //by WHO
                        "@ExpertiseSkill4GetUnit, @ExpertiseSkill4GetDate, @ExpertiseSkill4ValidDate, @Disease, @DiseaseExplain, @FileDate,@CreateFileBy, @UpFileBy, (getDate())) ";

                    SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                    cmd.Parameters.Add("@Unit", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.unit);
                    cmd.Parameters.Add("@StaffID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffID);
                    cmd.Parameters.Add("@StaffName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffName);
                    cmd.Parameters.Add("@AppoIntmentDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.officeDate);
                    cmd.Parameters.Add("@ResignationDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.resignDate);
                    cmd.Parameters.Add("@WorkItem", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.applyJob);
                    cmd.Parameters.Add("@JobCapacity", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.jobTitle);
                    cmd.Parameters.Add("@JobGrade", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.jobLevel);
                    cmd.Parameters.Add("@StaffIdentity", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffTWID);
                    cmd.Parameters.Add("@StaffAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffPhoto);
                    cmd.Parameters.Add("@Hometown", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.comeCity);
                    cmd.Parameters.Add("@Birthday", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.staffbirthday);
                    cmd.Parameters.Add("@sex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.staffsex);
                    cmd.Parameters.Add("@Marriage", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.marriage);
                    cmd.Parameters.Add("@AddressZip1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddressZip);
                    cmd.Parameters.Add("@AddressCity1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.censusCity);
                    cmd.Parameters.Add("@AddressOther1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddress);
                    cmd.Parameters.Add("@AddressZip2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.addressZip);
                    cmd.Parameters.Add("@AddressCity2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.addressCity);
                    cmd.Parameters.Add("@AddressOther2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.address);
                    cmd.Parameters.Add("@TelDaytime", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.TDaytime);
                    cmd.Parameters.Add("@TelNight", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.TNight);
                    cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Phone);
                    cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffemail);
                    cmd.Parameters.Add("@UrgentContactName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyName);
                    cmd.Parameters.Add("@UrgentContactAddress", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyAddress);
                    cmd.Parameters.Add("@UrgentContactTel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyPhone);
                    cmd.Parameters.Add("@DoctorSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DSchoolName);
                    cmd.Parameters.Add("@DoctorDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DDepartment);
                    cmd.Parameters.Add("@DoctorSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DSince);
                    cmd.Parameters.Add("@DoctorUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DUntil);
                    cmd.Parameters.Add("@DoctorState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study1);
                    cmd.Parameters.Add("@MasterSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MSchoolName);
                    cmd.Parameters.Add("@MasterDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MDepartment);
                    cmd.Parameters.Add("@MasterSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MSince);
                    cmd.Parameters.Add("@MasterUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MUntil);
                    cmd.Parameters.Add("@MasterState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study2);
                    cmd.Parameters.Add("@UniversitySchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.USchoolName);
                    cmd.Parameters.Add("@UniversityDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.UDepartment);
                    cmd.Parameters.Add("@UniversitySince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.USince);
                    cmd.Parameters.Add("@UniversityUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.UUntil);
                    cmd.Parameters.Add("@UniversityState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study3);
                    cmd.Parameters.Add("@VocationalSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VSchoolName);
                    cmd.Parameters.Add("@VocationalDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VDepartment);
                    cmd.Parameters.Add("@VocationalSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VSince);
                    cmd.Parameters.Add("@VocationalUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VUntil);
                    cmd.Parameters.Add("@VocationalState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study4);
                    cmd.Parameters.Add("@Experience1Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince1);
                    cmd.Parameters.Add("@Experience1Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil1);
                    cmd.Parameters.Add("@Experience1Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname1);
                    cmd.Parameters.Add("@Experience1Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition1);
                    cmd.Parameters.Add("@Experience1Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary1);
                    cmd.Parameters.Add("@Experience1Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove1);
                    cmd.Parameters.Add("@Experience1Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle1);
                    cmd.Parameters.Add("@Experience1DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName1);
                    cmd.Parameters.Add("@Experience2Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince2);
                    cmd.Parameters.Add("@Experience2Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil2);
                    cmd.Parameters.Add("@Experience2Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname2);
                    cmd.Parameters.Add("@Experience2Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition2);
                    cmd.Parameters.Add("@Experience2Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary2);
                    cmd.Parameters.Add("@Experience2Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove2);
                    cmd.Parameters.Add("@Experience2Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle2);
                    cmd.Parameters.Add("@Experience2DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName2);
                    cmd.Parameters.Add("@Experience3Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince3);
                    cmd.Parameters.Add("@Experience3Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil3);
                    cmd.Parameters.Add("@Experience3Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname3);
                    cmd.Parameters.Add("@Experience3Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition3);
                    cmd.Parameters.Add("@Experience3Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary3);
                    cmd.Parameters.Add("@Experience3Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove3);
                    cmd.Parameters.Add("@Experience3Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle3);
                    cmd.Parameters.Add("@Experience3DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName3);
                    cmd.Parameters.Add("@Experience4Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince4);
                    cmd.Parameters.Add("@Experience4Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil4);
                    cmd.Parameters.Add("@Experience4Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname4);
                    cmd.Parameters.Add("@Experience4Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition4);
                    cmd.Parameters.Add("@Experience4Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary4);
                    cmd.Parameters.Add("@Experience4Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove4);
                    cmd.Parameters.Add("@Experience4Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle4);
                    cmd.Parameters.Add("@Experience4DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName4);
                    cmd.Parameters.Add("@Family1Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][0]);
                    cmd.Parameters.Add("@Family1Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][1]);
                    cmd.Parameters.Add("@Family1Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[0][2]);
                    cmd.Parameters.Add("@Family1Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][3]);
                    cmd.Parameters.Add("@Family2Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][0]);
                    cmd.Parameters.Add("@Family2Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][1]);
                    cmd.Parameters.Add("@Family2Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[1][2]);
                    cmd.Parameters.Add("@Family2Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][3]);
                    cmd.Parameters.Add("@Family3Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][0]);
                    cmd.Parameters.Add("@Family3Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][1]);
                    cmd.Parameters.Add("@Family3Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[2][2]);
                    cmd.Parameters.Add("@Family3Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][3]);
                    cmd.Parameters.Add("@Family4Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][0]);
                    cmd.Parameters.Add("@Family4Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][1]);
                    cmd.Parameters.Add("@Family4Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[3][2]);
                    cmd.Parameters.Add("@Family4Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][3]);
                    cmd.Parameters.Add("@Family5Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][0]);
                    cmd.Parameters.Add("@Family5Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][1]);
                    cmd.Parameters.Add("@Family5Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[4][2]);
                    cmd.Parameters.Add("@Family5Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][3]);
                    cmd.Parameters.Add("@Family6Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][0]);
                    cmd.Parameters.Add("@Family6Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][1]);
                    cmd.Parameters.Add("@Family6Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[5][2]);
                    cmd.Parameters.Add("@Family6Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][3]);
                    cmd.Parameters.Add("@GuarantorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailName);
                    cmd.Parameters.Add("@GuarantorUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailUnit);
                    cmd.Parameters.Add("@GuarantorPost", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailJob);
                    cmd.Parameters.Add("@GuarantorRelationship", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailRelationship);
                    cmd.Parameters.Add("@GuarantorContact", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailContact);
                    cmd.Parameters.Add("@GuarantorContactTime", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailContactTime);
                    cmd.Parameters.Add("@CandidatesMessage", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.recruited);
                    cmd.Parameters.Add("@MessageExplain", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.recruitedText);
                    cmd.Parameters.Add("@Language1Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility1);
                    cmd.Parameters.Add("@Language1Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL1);
                    cmd.Parameters.Add("@Language1Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS1);
                    cmd.Parameters.Add("@Language1Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR1);
                    cmd.Parameters.Add("@Language1Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW1);
                    cmd.Parameters.Add("@Language2Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility2);
                    cmd.Parameters.Add("@Language2Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL2);
                    cmd.Parameters.Add("@Language2Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS2);
                    cmd.Parameters.Add("@Language2Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR2);
                    cmd.Parameters.Add("@Language2Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW2);
                    cmd.Parameters.Add("@Language3Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility3);
                    cmd.Parameters.Add("@Language3Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL3);
                    cmd.Parameters.Add("@Language3Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS3);
                    cmd.Parameters.Add("@Language3Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR3);
                    cmd.Parameters.Add("@Language3Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW3);

                    for (int i = 0; i < StaffData.SpecialtySkill.Count; i++)
                    {
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1), SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][0]);
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "License", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][1]);
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "Progression", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][2]);
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "GetUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][3]);
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "GetDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.SpecialtySkill[i][4]);
                        cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "ValidDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.SpecialtySkill[i][5]);

                    }
                    cmd.Parameters.Add("@TrialStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.TrialStart);//BY WHO
                    cmd.Parameters.Add("@TrialEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.TrialEnd);
                    cmd.Parameters.Add("@DealStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.DealStart);
                    cmd.Parameters.Add("@DealEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.DealEnd);
                    cmd.Parameters.Add("@CardNum", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.CardNum);//BY WHO

                    cmd.Parameters.Add("@FileDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.fillInDate);
                    cmd.Parameters.Add("@Disease", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.disease);
                    cmd.Parameters.Add("@DiseaseExplain", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.diseaseText);
                    cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                    cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                    returnValue[0] = cmd.ExecuteNonQuery().ToString();

                    if (returnValue[0] != "0")
                    {
                        string FieldName = "StaffDB_" + StaffData.unit;
                        Int64 Column = 0;
                        sql = "select IDENT_CURRENT('StaffDatabase') AS cID "+
                              "UPDATE AutomaticNumberTable SET " + FieldName + "=" + FieldName + "+1 WHERE ID=1 ";
                        cmd = new SqlCommand(sql, Sqlconn);
                        SqlDataReader dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            Column = Int64.Parse(dr["cID"].ToString());
                        }
                        dr.Close();

                        /*string stuIDName = "";
                        sql = "SELECT Count(*) AS QCOUNT FROM StaffDatabase WHERE Unit=(@Unit) ";
                        cmd = new SqlCommand(sql, Sqlconn);
                        cmd.Parameters.Add("@Unit", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(StaffData.unit);
                        string stuNumber = cmd.ExecuteScalar().ToString();*/
                        CaseDataBase SDB = new CaseDataBase();
                        string stuNumber = SDB.getUnitAutoNumber(FieldName);
                        string stuIDName = Chk.CheckStringtoIntFunction(StaffData.unit) + stuNumber.PadLeft(3, '0');

                        sql = "UPDATE StaffDatabase SET StaffID=(@StaffID) WHERE ID=(@TID) ";
                        cmd = new SqlCommand(sql, Sqlconn);
                        cmd.Parameters.Add("@TID", SqlDbType.BigInt).Value = Column;
                        cmd.Parameters.Add("@StaffID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(stuIDName);
                        returnValue[0] = cmd.ExecuteNonQuery().ToString();
                        returnValue[1] = Column.ToString();
                        returnValue[2] = stuIDName;
                    }

                    Sqlconn.Close();
                }
                catch (Exception e)
                {
                    returnValue[0] = "-1";
                    returnValue[1] = e.Message.ToString();
                }

            }
            return returnValue;
    }
    public int UpOneStaffDataBase(CreateStaff StaffData)
    {
        int returnValue = 0;
        string upPhoto = "";
        if (StaffData.staffPhoto != null)
        {
            upPhoto += " StaffAvatar=@StaffAvatar, ";
        }
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                List<string> CreateFileName = this.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "UPDATE StaffDatabase SET Unit=@Unit, StaffName=@StaffName, AppointmentDate=@AppointmentDate, ResignationDate=@ResignationDate, "+
                    "WorkItem=@WorkItem, JobCapacity=@JobCapacity, JobGrade=@JobGrade, StaffIdentity=@StaffIdentity,  Hometown=@Hometown, " +upPhoto+
                    "Birthday=@Birthday, sex=@sex, Marriage=@Marriage, AddressZip1=@AddressZip1, " +
                    "AddressCity1=@AddressCity1, AddressOther1=@AddressOther1, AddressZip2=@AddressZip2, AddressCity2=@AddressCity2, AddressOther2=@AddressOther2, " +
                    "TelDaytime=@TelDaytime, TelNight=@TelNight, Phone=@Phone, Email=@Email, UrgentContactName=@UrgentContactName, " +
                    "UrgentContactAddress=@UrgentContactAddress, UrgentContactTel=@UrgentContactTel, DoctorSchoolName=@DoctorSchoolName, DoctorDepartment=@DoctorDepartment, " +
                    "DoctorSince=@DoctorSince, DoctorUntil=@DoctorUntil, DoctorState=@DoctorState, MasterSchoolName=@MasterSchoolName, MasterDepartment=@MasterDepartment, " +
                    "MasterSince=@MasterSince, MasterUntil=@MasterUntil, MasterState=@MasterState, UniversitySchoolName=@UniversitySchoolName, " +
                    "UniversityDepartment=@UniversityDepartment, UniversitySince=@UniversitySince, UniversityUntil=@UniversityUntil, UniversityState=@UniversityState, " +
                    "VocationalSchoolName=@VocationalSchoolName, VocationalDepartment=@VocationalDepartment, VocationalSince=@VocationalSince, VocationalUntil=@VocationalUntil, " +
                    "VocationalState=@VocationalState, Experience1Since=@Experience1Since, Experience1Until=@Experience1Until, Experience1Company=@Experience1Company, " +
                    "Experience1Post=@Experience1Post, Experience1Salary=@Experience1Salary, Experience1Prove=@Experience1Prove, Experience1Director=@Experience1Director, " +
                    "Experience1DirectorName=@Experience1DirectorName, Experience2Since=@Experience2Since, Experience2Until=@Experience2Until, " +
                    "Experience2Company=@Experience2Company, Experience2Post=@Experience2Post, Experience2Salary=@Experience2Salary, Experience2Prove=@Experience2Prove, " +
                    "Experience2Director=@Experience2Director, Experience2DirectorName=@Experience2DirectorName, Experience3Since=@Experience3Since, " +
                    "Experience3Until=@Experience3Until, Experience3Company=@Experience3Company, Experience3Post=@Experience3Post, Experience3Salary=@Experience3Salary, " +
                    "Experience3Prove=@Experience3Prove, Experience3Director=@Experience3Director, Experience3DirectorName=@Experience3DirectorName, " +
                    "Experience4Since=@Experience4Since, Experience4Until=@Experience4Until, Experience4Company=@Experience4Company, Experience4Post=@Experience4Post, " +
                    "Experience4Salary=@Experience4Salary, Experience4Prove=@Experience4Prove, Experience4Director=@Experience4Director, " +
                    "Experience4DirectorName=@Experience4DirectorName, Family1Title=@Family1Title, Family1Name=@Family1Name, Family1Age=@Family1Age, " +
                    "Family1Profession=@Family1Profession, Family2Title=@Family2Title, Family2Name=@Family2Name, Family2Age=@Family2Age, Family2Profession=@Family2Profession, " +
                    "Family3Title=@Family3Title, Family3Name=@Family3Name, Family3Age=@Family3Age, Family3Profession=@Family3Profession, Family4Title=@Family4Title, " +
                    "Family4Name=@Family4Name, Family4Age=@Family4Age, Family4Profession=@Family4Profession, Family5Title=@Family5Title, Family5Name=@Family5Name, " +
                    "Family5Age=@Family5Age, Family5Profession=@Family5Profession, Family6Title=@Family6Title, Family6Name=@Family6Name, Family6Age=@Family6Age, " +
                    "Family6Profession=@Family6Profession, GuarantorName=@GuarantorName, GuarantorUnit=@GuarantorUnit, GuarantorPost=@GuarantorPost, " +
                    "GuarantorRelationship=@GuarantorRelationship, GuarantorContact=@GuarantorContact, GuarantorContactTime=@GuarantorContactTime, " +
                    "CandidatesMessage=@CandidatesMessage, MessageExplain=@MessageExplain, Language1Name=@Language1Name, Language1Listen=@Language1Listen, " +
                    "Language1Say=@Language1Say, Language1Read=@Language1Read, Language1Write=@Language1Write, Language2Name=@Language2Name, Language2Listen=@Language2Listen, " +
                    "Language2Say=@Language2Say, Language2Read=@Language2Read, Language2Write=@Language2Write, Language3Name=@Language3Name, Language3Listen=@Language3Listen, " +
                    "Language3Say=@Language3Say, Language3Read=@Language3Read, Language3Write=@Language3Write, ExpertiseSkill1=@ExpertiseSkill1, " +
                    "ExpertiseSkill1License=@ExpertiseSkill1License, ExpertiseSkill1Progression=@ExpertiseSkill1Progression, ExpertiseSkill1GetUnit=@ExpertiseSkill1GetUnit, " +
                    "ExpertiseSkill1GetDate=@ExpertiseSkill1GetDate, ExpertiseSkill1ValidDate=@ExpertiseSkill1ValidDate, ExpertiseSkill2=@ExpertiseSkill2, " +
                    "ExpertiseSkill2License=@ExpertiseSkill2License, ExpertiseSkill2Progression=@ExpertiseSkill2Progression, ExpertiseSkill2GetUnit=@ExpertiseSkill2GetUnit, " +
                    "ExpertiseSkill2GetDate=@ExpertiseSkill2GetDate, ExpertiseSkill2ValidDate=@ExpertiseSkill2ValidDate, ExpertiseSkill3=@ExpertiseSkill3, " +
                    "ExpertiseSkill3License=@ExpertiseSkill3License, ExpertiseSkill3Progression=@ExpertiseSkill3Progression, ExpertiseSkill3GetUnit=@ExpertiseSkill3GetUnit, " +
                    "ExpertiseSkill3GetDate=@ExpertiseSkill3GetDate, ExpertiseSkill3ValidDate=@ExpertiseSkill3ValidDate, ExpertiseSkill4=@ExpertiseSkill4, " +
                    "ExpertiseSkill4License=@ExpertiseSkill4License, ExpertiseSkill4Progression=@ExpertiseSkill4Progression, ExpertiseSkill4GetUnit=@ExpertiseSkill4GetUnit, " +
                    "ExpertiseSkill4GetDate=@ExpertiseSkill4GetDate, ExpertiseSkill4ValidDate=@ExpertiseSkill4ValidDate, Disease=@Disease, DiseaseExplain=@DiseaseExplain, " +
                    " TrialStart =@TrialStart , TrialEnd=@TrialEnd , DealStart=@DealStart , DealEnd=@DealEnd , CardNum=@CardNum,  "+ //by WHO
                    "UpFileBy=(@UpFileBy), UpFileDate=(getDate())" +
                    "WHERE ID=(@ID)";

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Chk.CheckStringFunction(StaffData.ID);
                cmd.Parameters.Add("@Unit", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.unit);
                cmd.Parameters.Add("@StaffName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffName);
                cmd.Parameters.Add("@AppoIntmentDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.officeDate);
                cmd.Parameters.Add("@ResignationDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.resignDate);
                cmd.Parameters.Add("@WorkItem", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.applyJob);
                cmd.Parameters.Add("@JobCapacity", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.jobTitle);
                cmd.Parameters.Add("@JobGrade", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.jobLevel);
                cmd.Parameters.Add("@StaffIdentity", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffTWID);
                cmd.Parameters.Add("@StaffAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffPhoto);
                cmd.Parameters.Add("@Hometown", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.comeCity);
                cmd.Parameters.Add("@Birthday", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.staffbirthday);
                cmd.Parameters.Add("@sex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.staffsex);
                cmd.Parameters.Add("@Marriage", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.marriage);
                cmd.Parameters.Add("@AddressZip1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddressZip);
                cmd.Parameters.Add("@AddressCity1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.censusCity);
                cmd.Parameters.Add("@AddressOther1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddress);
                cmd.Parameters.Add("@AddressZip2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.addressZip);
                cmd.Parameters.Add("@AddressCity2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.addressCity);
                cmd.Parameters.Add("@AddressOther2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.address);
                cmd.Parameters.Add("@TelDaytime", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.TDaytime);
                cmd.Parameters.Add("@TelNight", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.TNight);
                cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Phone);
                cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffemail);
                cmd.Parameters.Add("@UrgentContactName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyName);
                cmd.Parameters.Add("@UrgentContactAddress", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyAddress);
                cmd.Parameters.Add("@UrgentContactTel", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.EmergencyPhone);
                cmd.Parameters.Add("@DoctorSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DSchoolName);
                cmd.Parameters.Add("@DoctorDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DDepartment);
                cmd.Parameters.Add("@DoctorSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DSince);
                cmd.Parameters.Add("@DoctorUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.DUntil);
                cmd.Parameters.Add("@DoctorState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study1);
                cmd.Parameters.Add("@MasterSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MSchoolName);
                cmd.Parameters.Add("@MasterDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MDepartment);
                cmd.Parameters.Add("@MasterSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MSince);
                cmd.Parameters.Add("@MasterUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.MUntil);
                cmd.Parameters.Add("@MasterState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study2);
                cmd.Parameters.Add("@UniversitySchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.USchoolName);
                cmd.Parameters.Add("@UniversityDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.UDepartment);
                cmd.Parameters.Add("@UniversitySince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.USince);
                cmd.Parameters.Add("@UniversityUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.UUntil);
                cmd.Parameters.Add("@UniversityState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study3);
                cmd.Parameters.Add("@VocationalSchoolName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VSchoolName);
                cmd.Parameters.Add("@VocationalDepartment", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VDepartment);
                cmd.Parameters.Add("@VocationalSince", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VSince);
                cmd.Parameters.Add("@VocationalUntil", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.VUntil);
                cmd.Parameters.Add("@VocationalState", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.study4);
                cmd.Parameters.Add("@Experience1Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince1);
                cmd.Parameters.Add("@Experience1Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil1);
                cmd.Parameters.Add("@Experience1Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname1);
                cmd.Parameters.Add("@Experience1Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition1);
                cmd.Parameters.Add("@Experience1Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary1);
                cmd.Parameters.Add("@Experience1Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove1);
                cmd.Parameters.Add("@Experience1Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle1);
                cmd.Parameters.Add("@Experience1DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName1);
                cmd.Parameters.Add("@Experience2Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince2);
                cmd.Parameters.Add("@Experience2Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil2);
                cmd.Parameters.Add("@Experience2Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname2);
                cmd.Parameters.Add("@Experience2Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition2);
                cmd.Parameters.Add("@Experience2Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary2);
                cmd.Parameters.Add("@Experience2Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove2);
                cmd.Parameters.Add("@Experience2Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle2);
                cmd.Parameters.Add("@Experience2DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName2);
                cmd.Parameters.Add("@Experience3Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince3);
                cmd.Parameters.Add("@Experience3Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil3);
                cmd.Parameters.Add("@Experience3Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname3);
                cmd.Parameters.Add("@Experience3Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition3);
                cmd.Parameters.Add("@Experience3Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary3);
                cmd.Parameters.Add("@Experience3Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove3);
                cmd.Parameters.Add("@Experience3Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle3);
                cmd.Parameters.Add("@Experience3DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName3);
                cmd.Parameters.Add("@Experience4Since", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateSince4);
                cmd.Parameters.Add("@Experience4Until", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JDateUntil4);
                cmd.Parameters.Add("@Experience4Company", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JCname4);
                cmd.Parameters.Add("@Experience4Post", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jposition4);
                cmd.Parameters.Add("@Experience4Salary", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Jsalary4);
                cmd.Parameters.Add("@Experience4Prove", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.prove4);
                cmd.Parameters.Add("@Experience4Director", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitle4);
                cmd.Parameters.Add("@Experience4DirectorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.JTitleName4);
                cmd.Parameters.Add("@Family1Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][0]);
                cmd.Parameters.Add("@Family1Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][1]);
                cmd.Parameters.Add("@Family1Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[0][2]);
                cmd.Parameters.Add("@Family1Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[0][3]);
                cmd.Parameters.Add("@Family2Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][0]);
                cmd.Parameters.Add("@Family2Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][1]);
                cmd.Parameters.Add("@Family2Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[1][2]);
                cmd.Parameters.Add("@Family2Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[1][3]);
                cmd.Parameters.Add("@Family3Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][0]);
                cmd.Parameters.Add("@Family3Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][1]);
                cmd.Parameters.Add("@Family3Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[2][2]);
                cmd.Parameters.Add("@Family3Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[2][3]);
                cmd.Parameters.Add("@Family4Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][0]);
                cmd.Parameters.Add("@Family4Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][1]);
                cmd.Parameters.Add("@Family4Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[3][2]);
                cmd.Parameters.Add("@Family4Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[3][3]);
                cmd.Parameters.Add("@Family5Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][0]);
                cmd.Parameters.Add("@Family5Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][1]);
                cmd.Parameters.Add("@Family5Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[4][2]);
                cmd.Parameters.Add("@Family5Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[4][3]);
                cmd.Parameters.Add("@Family6Title", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][0]);
                cmd.Parameters.Add("@Family6Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][1]);
                cmd.Parameters.Add("@Family6Age", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.FamilyStatu[5][2]);
                cmd.Parameters.Add("@Family6Profession", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.FamilyStatu[5][3]);
                cmd.Parameters.Add("@GuarantorName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailName);
                cmd.Parameters.Add("@GuarantorUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailUnit);
                cmd.Parameters.Add("@GuarantorPost", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailJob);
                cmd.Parameters.Add("@GuarantorRelationship", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailRelationship);
                cmd.Parameters.Add("@GuarantorContact", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailContact);
                cmd.Parameters.Add("@GuarantorContactTime", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.bailContactTime);
                cmd.Parameters.Add("@CandidatesMessage", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.recruited);
                cmd.Parameters.Add("@MessageExplain", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.recruitedText);
                cmd.Parameters.Add("@Language1Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility1);
                cmd.Parameters.Add("@Language1Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL1);
                cmd.Parameters.Add("@Language1Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS1);
                cmd.Parameters.Add("@Language1Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR1);
                cmd.Parameters.Add("@Language1Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW1);
                cmd.Parameters.Add("@Language2Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility2);
                cmd.Parameters.Add("@Language2Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL2);
                cmd.Parameters.Add("@Language2Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS2);
                cmd.Parameters.Add("@Language2Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR2);
                cmd.Parameters.Add("@Language2Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW2);
                cmd.Parameters.Add("@Language3Name", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.langAbility3);
                cmd.Parameters.Add("@Language3Listen", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langL3);
                cmd.Parameters.Add("@Language3Say", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langS3);
                cmd.Parameters.Add("@Language3Read", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langR3);
                cmd.Parameters.Add("@Language3Write", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.langW3);

                for (int i = 0; i < StaffData.SpecialtySkill.Count; i++)
                {
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1), SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][0]);
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "License", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][1]);
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "Progression", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][2]);
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "GetUnit", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.SpecialtySkill[i][3]);
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "GetDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.SpecialtySkill[i][4]);
                    cmd.Parameters.Add("@ExpertiseSkill" + (i + 1) + "ValidDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.SpecialtySkill[i][5]);

                }
                cmd.Parameters.Add("@TrialStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.TrialStart);
                cmd.Parameters.Add("@TrialEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.TrialEnd);
                cmd.Parameters.Add("@DealStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.DealStart);
                cmd.Parameters.Add("@DealEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(StaffData.DealEnd);
                cmd.Parameters.Add("@CardNum", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.CardNum);
                //" TrialStart =@TrialStart , TrialEnd=@TrialEnd , DealStart=@DealStart , DealEnd=@DealEnd , CardNum=@CardNum,  " + //by WHO
                cmd.Parameters.Add("@Disease", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.disease);
                cmd.Parameters.Add("@DiseaseExplain", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.diseaseText);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue = cmd.ExecuteNonQuery();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                string item = e.Message;
                returnValue = -1;
            }

        }
        return returnValue;
    }
    public string[] setCreateUserMemberPhotoData(CreateStaff StaffData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        string upPhoto = "";
        if (StaffData.staffPhoto != null)
        {
            upPhoto += " StaffAvatar=@StaffAvatar, ";
        }
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                List<string> CreateFileName = this.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "UPDATE StaffDatabase SET " + upPhoto + "UpFileBy=(@UpFileBy), UpFileDate=(getDate()) " +
                    "WHERE ID=(@ID)";

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Chk.CheckStringFunction(StaffData.ID);
                cmd.Parameters.Add("@StaffAvatar", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffPhoto);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                returnValue[1] = StaffData.ID;
                Sqlconn.Close();

            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
Beispiel #9
0
        public void Create(CreateStaff command)
        {
            var staff = new Domain.StaffAgg.Staff(command.Name, command.RegisterDate);

            _staffRepository.Create(staff);
        }