예제 #1
0
        public void CreateMilitary(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_MILITARY} (" +
                                      $"id_user, unit, unit_id, country_id, \"from\", \"until\")" +
                                      $"VALUES(@id_user, @unit, @unit_id, @country_id, @from, @until)";

                foreach (var item in user.Military)
                {
                    using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("unit", item.Unit));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("unit_id", item.UnitId));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("country_id", item.CountryId));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("from", item.From));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("until", item.Until));

                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
예제 #2
0
        public void CreatePhote(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();
                string insertApiKey = $"INSERT INTO {TABLE_PHOTO} (" +
                                      $"id_user, photo_50, photo_100, photo_200, photo_200_orig, photo_max, photo_400_orig, photo_max_orig, photo_id)" +
                                      $"VALUES(@id_user, @photo_50, @photo_100, @photo_200, @photo_200_orig, @photo_max, @photo_400_orig, @photo_max_orig, @photo_id)";

                using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                {
                    cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_50", user.Photo50));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_100", user.Photo100));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_200", user.Photo200));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_200_orig", user.Photo200_Orig));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_max", user.PhotoMax));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_400_orig", user.Photo400_Orig));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_max_orig", user.PhotoMaxOrig));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("photo_id", user.PhotoId));

                    cmd.ExecuteNonQuery();
                }
            }
        }
예제 #3
0
        public void CreateSchool(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_SCHOOL} (" +
                                      $"id_user, id_school, country, city, \"name\", year_from, year_to, year_graduated, \"class\", speciality, \"type\", type_str)" +
                                      $"VALUES(@id_user, @id_school, @country, @city, @name, @year_from, @year_to, @year_graduated, @class, @speciality, @type, @type_str)";

                foreach (var item in user.Schools)
                {
                    using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_school", item.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("country", item.Country));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("city", item.City));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("name", item.Name));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("year_from", item.YearFrom));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("year_to", item.YearTo));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("year_graduated", item.YearGraduated));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("class", item.ClassLatter));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("speciality", item.Speciality));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("type", item.Type));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("type_str", item.TypeStr));

                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
예제 #4
0
        public void CreateUniversity(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_UNIVERSITY} (" +
                                      $"id_user, id_university, country, city, \"name\", faculty, faculty_name, chair, chair_name, graduation, education_form, education_status)" +
                                      $"VALUES(@id_user, @id_university, @country, @city, @name, @faculty, @faculty_name, @chair, @chair_name, @graduation, @education_form, @education_status)";

                foreach (var item in user.Universities)
                {
                    using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_university", item.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("country", item.Country));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("city", item.City));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("name", item.Name));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("faculty", item.Faculty));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("faculty_name", item.FacultyName));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("chair", item.Chair));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("chair_name", item.ChairName));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("graduation", item.Graduation));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("education_form", item.EducationForm));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("education_status", item.EducationStatus));

                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
        public async Task AddNewPersonAsync(string name)
        {
            try
            {
                //basic validation to ensure a name was entered
                if (string.IsNullOrEmpty(name))
                {
                    throw new Exception("Valid name required");
                }

                var person = new EntityPerson()
                {
                    Name = name,
                };

                // TODO: insert a new person into the Person table
                var result = await Connection.InsertAsync(person);

                StatusMessage = $"{result} record(s) added [Name: {name})";
            }
            catch (Exception ex)
            {
                StatusMessage = $"Failed to add {name}. Error: {ex.Message}";
            }
        }
예제 #6
0
 public virtual EntityPerson GetPersonByID(EntityPerson pPerson)
 {
     using (var connection = SchemaDB.Database.GetDbConnection())
     {
         return(connection.Query <EntityPerson>("stp_GER_GetEntityPersonByID", new { pEntityID = pPerson.ID }, commandType: CommandType.StoredProcedure).FirstOrDefault());
     }
 }
예제 #7
0
        public void CreateCareer(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_CAREER} (" +
                                      $"id_user, company, group_id, country_id, city_id, city_name, \"position\", \"from\", \"until\")" +
                                      $"VALUES(@id_user, @company, @group_id, @country_id, @city_id, @city_name, @position, @from, @until)";

                foreach (var item in user.Careers)
                {
                    using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("company", item.Company));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("group_id", item.GroupId));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("country_id", item.CountryId));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("city_id", item.CityId));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("city_name", item.CityName));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("position", item.Position));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("from", item.From));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("until", item.Until));

                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
예제 #8
0
 public virtual IEnumerable <EntityPerson> GetPersonsByFilter(EntityPerson pPerson)
 {
     using (var connection = SchemaDB.Database.GetDbConnection())
     {
         return(connection.Query <EntityPerson>("stp_GER_GetEntityPersonByFilter", new { pDesignation = pPerson.Designation }, commandType: CommandType.StoredProcedure));
     }
 }
예제 #9
0
        public EntityResultSearch SearchPerson(EntityPerson person, string key)
        {
            var url = $"search/physical?" +
                      $"token={key}" +
                      $"&region={person?.Region}" +
                      $"&firstname={person?.Firstname}" +
                      $"&lastname={person?.Lastname}"
                      + (string.IsNullOrEmpty(person.Secondname) ? "" : $"&secondname={person?.Secondname}")
                      + (string.IsNullOrEmpty(person.Birthdate) ? "" : $"&birthdate={person?.Birthdate}");

            return(GetResultSearch(url));
        }
예제 #10
0
        // F2ボタン(クリア) クリック
        public override void btnF2_Click(object sender, RoutedEventArgs e)
        {
            // 初期化
            _entity = null;
            SetBinding();

            this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Init;

            this.utlID.txtID_IsReadOnly = false;
            this.utlID.txtID.Text       = "";
            ExBackgroundWorker.DoWork_Focus(this.utlID, 10);

            // ロック解除
            DataPgLock.gLockPg(PG_NM, "", (int)DataPgLock.geLockType.UnLock);
        }
예제 #11
0
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
            case _GetWebServiceCallKbn:
                // 更新
                if (objList != null)
                {
                    _entity = (EntityPerson)objList;

                    if (_entity.message != "" && _entity.message != null)
                    {
                        this.utlID.txtID.Text = "";
                        ExBackgroundWorker.DoWork_Focus(this.utlID, 10);
                        return;
                    }
                    else
                    {
                        // バインド反映
                        SetBinding();

                        if (_entity._lock_flg == 0)
                        {
                            this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                        }
                        else
                        {
                            this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                        }
                    }
                }
                // 新規
                else
                {
                    _entity = new EntityPerson();
                    SetBinding();
                    this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                }
                this.utlID.txtID_IsReadOnly = true;
                ExBackgroundWorker.DoWork_Focus(this.txtName, 10);
                break;

            default:
                break;
            }
        }
예제 #12
0
        public void CreateRelationPartner(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_RELATION_PARTNER} (" +
                                      $"id_user, id_relation_partner, first_name, last_name)" +
                                      $"VALUES(@id_user, @id_relation_partner, @first_name, @last_name)";

                var item = user.RelationPartner;

                using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                {
                    cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("id_relation_partner", item.Id));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("first_name", item.FirstName));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("last_name", item.LastName));

                    cmd.ExecuteNonQuery();
                }
            }
        }
예제 #13
0
        public void CreateRelation(EntityPerson user)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();

                string insertApiKey = $"INSERT INTO {TABLE_RELATION} (" +
                                      $"id_user, id_relative, \"name\", \"type\")" +
                                      $"VALUES(@id_user, @id_relative, @name, @type)";

                foreach (var item in user.Relatives)
                {
                    using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                    {
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <int>("id_relative", item.Id));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("name", item.Name));
                        cmd.Parameters.Add(new NpgsqlParameter <string>("type", item.Type));

                        cmd.ExecuteNonQuery();
                    }
                }
            }
        }
 private void GetPerson(int id)
 {
     try
     {
         objPerson = null;   // 初期化
         svcPersonClient svc = new svcPersonClient();
         svc.GetPersonCompleted += new EventHandler<GetPersonCompletedEventArgs>(this.GetPersonCompleted);
         svc.GetPersonAsync(Common.gstrSessionString, id);
     }
     catch (Exception ex)
     {
         this.ProcessingDlgClose();
         ExMessageBox.Show(CLASS_NM + ".GetPerson" + Environment.NewLine + ex.ToString(), "エラー確認");
     }
 }
 private void UpdatePerson(int type, long Id, EntityPerson entity)
 {
     try
     {
         svcPersonClient svc = new svcPersonClient();
         svc.UpdatePersonCompleted += new EventHandler<UpdatePersonCompletedEventArgs>(this.UpdatePersonCompleted);
         svc.UpdatePersonAsync(Common.gstrSessionString, type, Id, entity);
     }
     catch (Exception ex)
     {
         this.ProcessingDlgClose();
         ExMessageBox.Show(CLASS_NM + ".UpdatePerson" + Environment.NewLine + ex.ToString(), "エラー確認");
     }
 }
예제 #16
0
 public void UpdatePerson(EntityPerson pPerson)
 {
     SchemaDB.EntityPerson.Update(pPerson);
     SchemaDB.SaveChanges();
 }
예제 #17
0
 public void AddPerson(EntityPerson pPerson)
 {
     SchemaDB.EntityPerson.Add(pPerson);
     SchemaDB.SaveChanges();
 }
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
                case _GetWebServiceCallKbn:
                    // 更新
                    if (objList != null)
                    {
                        _entity = (EntityPerson)objList;

                        if (_entity.message != "" && _entity.message != null)
                        {
                            this.utlID.txtID.Text = "";
                            ExBackgroundWorker.DoWork_Focus(this.utlID, 10);
                            return;
                        }
                        else
                        {
                            // バインド反映
                            SetBinding();

                            if (_entity._lock_flg == 0)
                            {
                                this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                            }
                            else
                            {
                                this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                            }
                        }
                    }
                    // 新規
                    else
                    {
                        _entity = new EntityPerson();
                        SetBinding();
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                    }
                    this.utlID.txtID_IsReadOnly = true;
                    ExBackgroundWorker.DoWork_Focus(this.txtName, 10);
                    break;
                default:
                    break;
            }
        }
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityPerson();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCompanyGroup.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            // バインド
            Binding BindingName = new Binding("_name");
            BindingName.Mode = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingGroupId = new Binding("_group_id");
            BindingGroupId.Mode = BindingMode.TwoWay;
            BindingGroupId.Source = _entity;
            this.utlCompanyGroup.txtID.SetBinding(TextBox.TextProperty, BindingGroupId);

            Binding BindingGroupName = new Binding("_group_nm");
            BindingGroupName.Mode = BindingMode.TwoWay;
            BindingGroupName.Source = _entity;
            this.utlCompanyGroup.txtNm.SetBinding(TextBox.TextProperty, BindingGroupName);

            Binding BindingDisplayDivisionId = new Binding("_display_division_id");
            BindingDisplayDivisionId.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindingDisplayDivisionId);

            Binding BindingDisplayDivisionNm = new Binding("_display_division_nm");
            BindingDisplayDivisionNm.Mode = BindingMode.TwoWay;
            BindingDisplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindingDisplayDivisionNm);

            Binding BindingMemo = new Binding("_memo");
            BindingMemo.Mode = BindingMode.TwoWay;
            BindingMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            this.utlID.txtID.SetZeroToNullString();

            // 初期値設定
            if (ExCast.zCInt(this.utlCompanyGroup.txtID.Text.Trim()) == 0)
            {
                this.utlCompanyGroup.MstID_Changed(null, new PropertyChangedEventArgs("_group_id"));
            }
            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._display_division_id = 1;
            }

        }
        // F2ボタン(クリア) クリック
        public override void btnF2_Click(object sender, RoutedEventArgs e)
        {
            // 初期化
            _entity = null;
            SetBinding();

            this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Init;

            this.utlID.txtID_IsReadOnly = false;
            this.utlID.txtID.Text = "";
            ExBackgroundWorker.DoWork_Focus(this.utlID, 10);

            // ロック解除
            DataPgLock.gLockPg(PG_NM, "", (int)DataPgLock.geLockType.UnLock);
        }
예제 #21
0
        public string UpdatePerson(string random, int type, long Id, EntityPerson entity)
        {
            #region 認証処理

            string companyId     = "";
            string groupId       = "";
            string userId        = "";
            string ipAdress      = "";
            string sessionString = "";
            string personId      = "";

            try
            {
                companyId     = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId       = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId        = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress      = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);
                personId      = ExCast.zCStr(HttpContext.Current.Session[ExSession.PERSON_ID]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    return(_message);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(認証処理)", ex);
                return(CLASS_NM + ".UpdatePerson : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString());
            }

            #endregion

            #region Field

            StringBuilder sb = new StringBuilder();
            DataTable     dt;
            ExMySQLData   db  = null;
            string        _Id = "";

            #endregion

            #region Databese Open

            try
            {
                db = new ExMySQLData(ExCast.zCStr(HttpContext.Current.Session[ExSession.DB_CONNECTION_STR]));
                db.DbOpen();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(DbOpen)", ex);
                return(CLASS_NM + ".UpdatePerson(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region BeginTransaction

            try
            {
                db.ExBeginTransaction();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(BeginTransaction)", ex);
                return(CLASS_NM + ".UpdatePerson(BeginTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Get Max Master ID

            if (type == 1 && Id == 0)
            {
                try
                {
                    DataMasterId.GetMaxMasterId(companyId,
                                                "",
                                                db,
                                                DataMasterId.geMasterMaxIdKbn.Person,
                                                out _Id);
                    if (_Id == "")
                    {
                        return("ID取得に失敗しました。");
                    }
                }
                catch (Exception ex)
                {
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(GetMaxMasterId)", ex);
                    return(CLASS_NM + ".UpdatePerson(GetMaxMasterId) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }
            else
            {
                _Id = Id.ToString();
            }

            #endregion

            #region Insert

            if (type == 1)
            {
                try
                {
                    #region Delete SQL

                    sb.Length = 0;
                    sb.Append("DELETE FROM M_PERSON " + Environment.NewLine);
                    sb.Append(" WHERE DELETE_FLG = 1 " + Environment.NewLine);
                    sb.Append("   AND COMPANY_ID = " + companyId + Environment.NewLine);
                    sb.Append("   AND ID = " + _Id.ToString() + Environment.NewLine);

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);

                    #region Insert SQL

                    sb.Length = 0;
                    sb.Append("INSERT INTO M_PERSON " + Environment.NewLine);
                    sb.Append("       ( COMPANY_ID" + Environment.NewLine);
                    sb.Append("       , ID" + Environment.NewLine);
                    sb.Append("       , GROUP_ID" + Environment.NewLine);
                    sb.Append("       , NAME" + Environment.NewLine);
                    sb.Append("       , MEMO" + Environment.NewLine);
                    sb.Append("       , DISPLAY_FLG" + Environment.NewLine);
                    sb.Append("       , UPDATE_FLG" + Environment.NewLine);
                    sb.Append("       , DELETE_FLG" + Environment.NewLine);
                    sb.Append("       , CREATE_PG_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_ADRESS" + Environment.NewLine);
                    sb.Append("       , CREATE_USER_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_PERSON_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_DATE" + Environment.NewLine);
                    sb.Append("       , CREATE_TIME" + Environment.NewLine);
                    sb.Append("       , UPDATE_PG_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_ADRESS" + Environment.NewLine);
                    sb.Append("       , UPDATE_USER_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_PERSON_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_DATE" + Environment.NewLine);
                    sb.Append("       , UPDATE_TIME" + Environment.NewLine);
                    sb.Append(")" + Environment.NewLine);
                    sb.Append("SELECT  " + companyId + Environment.NewLine);                                                // COMPANY_ID
                    sb.Append("       ," + _Id.ToString() + Environment.NewLine);                                           // ID
                    sb.Append("       ," + entity.group_id + Environment.NewLine);                                          // GROUP_ID
                    sb.Append("       ," + ExEscape.zRepStr(entity.name) + Environment.NewLine);                            // NAME
                    sb.Append("       ," + ExEscape.zRepStr(entity.memo) + Environment.NewLine);                            // MEMO
                    sb.Append("       ," + entity.display_division_id + Environment.NewLine);                               // DISPLAY_FLG
                    sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins,
                                                              PG_NM,
                                                              "M_PERSON",
                                                              ExCast.zCInt(personId),
                                                              _Id,
                                                              ipAdress,
                                                              userId));

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(Insert)", ex);
                    return(CLASS_NM + ".UpdatePerson(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region Update

            if (type == 0)
            {
                try
                {
                    #region SQL

                    sb.Length = 0;
                    sb.Append("UPDATE M_PERSON " + Environment.NewLine);
                    sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM,
                                                              ExCast.zCInt(personId),
                                                              ipAdress,
                                                              userId,
                                                              0));
                    sb.Append("      ,GROUP_ID = " + entity.group_id + Environment.NewLine);
                    sb.Append("      ,NAME = " + ExEscape.zRepStr(entity.name) + Environment.NewLine);
                    sb.Append("      ,MEMO = " + ExEscape.zRepStr(entity.memo) + Environment.NewLine);
                    sb.Append("      ,DISPLAY_FLG = " + entity.display_division_id + Environment.NewLine);
                    sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);        // COMPANY_ID
                    sb.Append("   AND ID = " + Id.ToString() + Environment.NewLine);            // ID

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(Update)", ex);
                    return(CLASS_NM + ".UpdatePerson(Update) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region Delete

            if (type == 2)
            {
                #region Exist Data

                try
                {
                    bool _ret = false;

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_ESTIMATE_H", "PERSON_ID", Id.ToString(), CommonUtl.geStrOrNumKbn.Number);
                    if (_ret == true)
                    {
                        return("担当ID : " + string.Format("{0:000}", Id) + " は見積データの入力担当者に使用されている為、削除できません。");
                    }

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_ORDER_H", "PERSON_ID", Id.ToString(), CommonUtl.geStrOrNumKbn.Number);
                    if (_ret == true)
                    {
                        return("担当ID : " + string.Format("{0:000}", Id) + " は受注データの入力担当者に使用されている為、削除できません。");
                    }

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_SALES_H", "PERSON_ID", Id.ToString(), CommonUtl.geStrOrNumKbn.Number);
                    if (_ret == true)
                    {
                        return("担当ID : " + string.Format("{0:000}", Id) + " は売上データの入力担当者に使用されている為、削除できません。");
                    }

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_RECEIPT_H", "PERSON_ID", Id.ToString(), CommonUtl.geStrOrNumKbn.Number);
                    if (_ret == true)
                    {
                        return("担当ID : " + string.Format("{0:000}", Id) + " は入金データの入力担当者に使用されている為、削除できません。");
                    }
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(Exist Data)", ex);
                    return(CLASS_NM + ".UpdatePerson(Exist Data) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }

                #endregion

                #region Update

                try
                {
                    sb.Length = 0;
                    sb.Append("UPDATE M_PERSON " + Environment.NewLine);
                    sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM,
                                                              ExCast.zCInt(personId),
                                                              ipAdress,
                                                              userId,
                                                              1));
                    sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);    // COMPANY_ID
                    sb.Append("   AND ID = " + Id.ToString() + Environment.NewLine);        // ID

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(Delete)", ex);
                    return(CLASS_NM + ".UpdatePerson(Delete) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }

                #endregion
            }

            #endregion

            #region PG排他制御

            if (type == 0 || type == 2)
            {
                try
                {
                    DataPgLock.DelLockPg(companyId, userId, PG_NM, "", ipAdress, false, db);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(DelLockPg)", ex);
                    return(CLASS_NM + ".UpdatePerson(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region CommitTransaction

            try
            {
                db.ExCommitTransaction();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(CommitTransaction)", ex);
                return(CLASS_NM + ".UpdatePerson(CommitTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Database Close

            try
            {
                db.DbClose();
            }
            catch (Exception ex)
            {
                db.ExRollbackTransaction();
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(DbClose)", ex);
                return(CLASS_NM + ".UpdatePerson(DbClose) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }
            finally
            {
                db = null;
            }

            #endregion

            #region Add Evidence

            try
            {
                switch (type)
                {
                case 0:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Update,
                                               "ID:" + Id.ToString());
                    break;

                case 1:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Insert,
                                               "ID:" + _Id.ToString());
                    break;

                case 2:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Delete,
                                               "ID:" + Id.ToString());
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdatePerson(Add Evidence)", ex);
                return(CLASS_NM + ".UpdatePerson(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Return

            if (type == 1 && Id == 0)
            {
                return("Auto Insert success : " + "ID : " + _Id.ToString() + "で登録しました。");
            }
            else
            {
                return("");
            }

            #endregion
        }
예제 #22
0
 public Candidate()
 {
     Person = new EntityPerson();
 }
예제 #23
0
        public void CreateUser(EntityPerson user, string source)
        {
            using (NpgsqlConnection conn = new NpgsqlConnection(_connectionString))
            {
                conn.Open();
                string insertApiKey = $"INSERT INTO {TABLE_USER} (" +
                                      $"id_user, first_name, last_name, deactivated, is_closed, can_access_closed, about, activities, bdate, blacklisted, blacklisted_by_me, books," +
                                      $"can_post, can_see_all_posts, can_see_audio, can_write_private_message, can_send_friend_request, city, common_count, country," +
                                      $"\"domain\", followers_count, friend_status, games, has_photo, has_mobile, home_town, interests, is_favorite, is_friend," +
                                      $"is_hidden_from_feed, last_seen_time, last_seen_platform, maiden_name, movies, music, nickname, online, online_app, online_mobile, quotes," +
                                      $" relation, screen_name, sex, site, status, trending, tv, verified, wall_default, can_be_invited_group, skype, facebook," +
                                      $"facebook_name, livejournal, twitter, instagram, mobile_phone, home_phone, occupation_type, occupation_id," +
                                      $"occupation_name, political, langs, religion, religion_id, inspired_by, people_main, life_main, smoking, alcohol, \"source\", create_data" +
                                      $") VALUES (" +
                                      $"@id_user, @first_name, @last_name, @deactivated, @is_closed, @can_access_closed, @about, @activities, @bdate, @blacklisted, @blacklisted_by_me, @books," +
                                      $"@can_post, @can_see_all_posts, @can_see_audio, @can_write_private_message, @can_send_friend_request, @city, @common_count, @country," +
                                      $"@domain, @followers_count, @friend_status, @games, @has_photo, @has_mobile, @home_town, @interests, @is_favorite, @is_friend," +
                                      $"@is_hidden_from_feed, @last_seen_time, @last_seen_platform, @maiden_name, @movies, @music, @nickname, @online, @online_app, @online_mobile, @quotes," +
                                      $"@relation, @screen_name, @sex, @site, @status, @trending, @tv, @verified, @wall_default, @can_be_invited_group, @skype, @facebook," +
                                      $"@facebook_name, @livejournal, @twitter, @instagram, @mobile_phone, @home_phone, @occupation_type, @occupation_id," +
                                      $"@occupation_name, @political, @langs, @religion, @religion_id, @inspired_by, @people_main, @life_main, @smoking, @alcohol, @source, @create_data" +
                                      $")";

                using (NpgsqlCommand cmd = new NpgsqlCommand(insertApiKey, conn))
                {
                    cmd.Parameters.Add(new NpgsqlParameter <int>("id_user", user.Id));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("first_name", user.FirstName));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("last_name", user.LastName));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("deactivated", user.Deactivated));
                    cmd.Parameters.Add(new NpgsqlParameter <bool>("is_closed", user.IsClosed));
                    cmd.Parameters.Add(new NpgsqlParameter <bool>("can_access_closed", user.CanAccessClosed));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("about", user.About));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("activities", user.Activities));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("bdate", user.Bdate));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("blacklisted", user.Blacklisted));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("blacklisted_by_me", user.BlacklistedByMe));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("books", user.Books));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("can_post", user.CanPost));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("can_see_all_posts", user.CanSeeAllPosts));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("can_see_audio", user.CanSeeAudio));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("can_write_private_message", user.CanWritePrivateMessage));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("can_send_friend_request", user.CanWritePrivateMessage));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.City?.Id ?? DBNull.Value, ParameterName = "city"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <int>("common_count", user.CommonCount));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Country?.Id ?? DBNull.Value, ParameterName = "country"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("domain", user.Domain));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("followers_count", user.FollowersCount));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("friend_status", user.FriendStatus));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("games", user.Games));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("has_photo", user.HasPhoto));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("has_mobile", user.HasMobile));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("home_town", user.HomeTown));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("interests", user.Interests));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("is_favorite", user.IsFavorite));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("is_friend", user.IsFriend));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("is_hidden_from_feed", user.IsHiddenFromFeed));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.LastSeen?.Time ?? DBNull.Value, ParameterName = "last_seen_time"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.LastSeen?.Platform ?? DBNull.Value, ParameterName = "last_seen_platform"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("maiden_name", user.MaidenName));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("movies", user.Movies));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("music", user.Music));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("nickname", user.Nickname));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("online", user.Online));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("online_app", user.OnlineApp));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("online_mobile", user.OnlineMobile));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("quotes", user.Quotes));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("relation", user.Relation));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("screen_name", user.ScreenName));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("sex", user.Sex));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("site", user.Site));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("status", user.Status));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("trending", user.Trending));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("tv", user.Tv));
                    cmd.Parameters.Add(new NpgsqlParameter <int>("verified", user.Verified));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("wall_default", user.WallDefault));
                    cmd.Parameters.Add(new NpgsqlParameter <bool>("can_be_invited_group", user.CanBeInvitedGroup));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("skype", user.Skype));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("facebook", user.Facebook));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("facebook_name", user.FacebookName));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("livejournal", user.Livejournal));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("twitter", user.Twitter));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("instagram", user.Instagram));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("mobile_phone", user.MobilePhone));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("home_phone", user.HomePhone));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("occupation_type", user.Occupation?.Type));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Occupation?.Id ?? DBNull.Value, ParameterName = "occupation_id"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("occupation_name", user.Occupation?.Name));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.Political ?? DBNull.Value, ParameterName = "political"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("langs", user.Personal?.LangToString()));
                    cmd.Parameters.Add(new NpgsqlParameter <string>("religion", user.Personal?.Religion));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.ReligionId ?? DBNull.Value, ParameterName = "religion_id"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("inspired_by", user.Personal?.InspiredBy));
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.PeopleMain ?? DBNull.Value, ParameterName = "people_main"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.LifeMain ?? DBNull.Value, ParameterName = "life_main"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.Smoking ?? DBNull.Value, ParameterName = "smoking"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter()
                    {
                        Value = (object)user.Personal?.Alcohol ?? DBNull.Value, ParameterName = "alcohol"
                    });
                    cmd.Parameters.Add(new NpgsqlParameter <string>("source", source));
                    cmd.Parameters.Add(new NpgsqlParameter("create_data", DateTime.Now));
                    cmd.ExecuteNonQuery();
                }
            }
        }
예제 #24
0
        public EntityPerson GetPerson(string random, int Id)
        {
            EntityPerson entity = null;

            #region 認証処理

            string companyId     = "";
            string groupId       = "";
            string userId        = "";
            string ipAdress      = "";
            string sessionString = "";

            try
            {
                companyId     = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId       = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId        = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress      = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    entity         = new EntityPerson();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetPersonList(認証処理)", ex);
                entity         = new EntityPerson();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                return(entity);
            }


            #endregion

            StringBuilder sb;
            DataTable     dt;
            ExMySQLData   db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));

                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT PS.* " + Environment.NewLine);
                sb.Append("      ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine);
                sb.Append("      ,SG.NAME AS GROUP_NAME " + Environment.NewLine);
                sb.Append("  FROM M_PERSON AS PS" + Environment.NewLine);

                // 表示区分
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine);
                sb.Append("    ON NM.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine);
                sb.Append("   AND PS.DISPLAY_FLG = NM.ID" + Environment.NewLine);

                // グループ
                sb.Append("  LEFT JOIN SYS_M_COMPANY_GROUP AS SG" + Environment.NewLine);
                sb.Append("    ON SG.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND SG.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND SG.COMPANY_ID = PS.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND SG.ID = PS.GROUP_ID" + Environment.NewLine);

                sb.Append(" WHERE PS.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND PS.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND PS.ID = " + Id.ToString() + Environment.NewLine);

                sb.Append(" ORDER BY PS.COMPANY_ID " + Environment.NewLine);
                sb.Append("         ,PS.ID " + Environment.NewLine);

                #endregion

                dt = db.GetDataTable(sb.ToString());

                if (dt.DefaultView.Count > 0)
                {
                    entity = new EntityPerson();

                    // 排他制御
                    DataPgLock.geLovkFlg lockFlg;
                    string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, Id.ToString(), ipAdress, db, out lockFlg);
                    if (strErr != "")
                    {
                        entity.MESSAGE = CLASS_NM + ".GetPerson : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    }

                    int    _group_id = ExCast.zCInt(dt.DefaultView[0]["GROUP_ID"]);
                    string _group_nm = "";
                    if (_group_id == 0)
                    {
                        _group_nm = "全て";
                    }
                    else
                    {
                        _group_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME"]);
                    }

                    #region Set Entity

                    entity.id                  = ExCast.zCInt(dt.DefaultView[0]["ID"]);
                    entity.name                = ExCast.zCStr(dt.DefaultView[0]["NAME"]);
                    entity.group_id            = string.Format("{0:000}", _group_id);
                    entity.group_nm            = _group_nm;
                    entity.memo                = ExCast.zCStr(dt.DefaultView[0]["MEMO"]);
                    entity.display_division_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]);
                    entity.display_division_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]);
                    entity.lock_flg            = (int)lockFlg;

                    #endregion
                }
                else
                {
                    entity = null;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetPerson", ex);
                entity         = new EntityPerson();
                entity.MESSAGE = CLASS_NM + ".GetPerson : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();
            }
            finally
            {
                db = null;
            }

            svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                       companyId,
                                       userId,
                                       ipAdress,
                                       sessionString,
                                       PG_NM,
                                       DataPgEvidence.geOperationType.Select,
                                       "ID:" + Id.ToString());

            return(entity);
        }
예제 #25
0
        private void SetBinding()
        {
            if (_entity == null)
            {
                _entity = new EntityPerson();
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCompanyGroup.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            // バインド
            Binding BindingName = new Binding("_name");

            BindingName.Mode   = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingGroupId = new Binding("_group_id");

            BindingGroupId.Mode   = BindingMode.TwoWay;
            BindingGroupId.Source = _entity;
            this.utlCompanyGroup.txtID.SetBinding(TextBox.TextProperty, BindingGroupId);

            Binding BindingGroupName = new Binding("_group_nm");

            BindingGroupName.Mode   = BindingMode.TwoWay;
            BindingGroupName.Source = _entity;
            this.utlCompanyGroup.txtNm.SetBinding(TextBox.TextProperty, BindingGroupName);

            Binding BindingDisplayDivisionId = new Binding("_display_division_id");

            BindingDisplayDivisionId.Mode   = BindingMode.TwoWay;
            BindingDisplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindingDisplayDivisionId);

            Binding BindingDisplayDivisionNm = new Binding("_display_division_nm");

            BindingDisplayDivisionNm.Mode   = BindingMode.TwoWay;
            BindingDisplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindingDisplayDivisionNm);

            Binding BindingMemo = new Binding("_memo");

            BindingMemo.Mode   = BindingMode.TwoWay;
            BindingMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindingMemo);

            this.utlID.txtID.SetZeroToNullString();

            // 初期値設定
            if (ExCast.zCInt(this.utlCompanyGroup.txtID.Text.Trim()) == 0)
            {
                this.utlCompanyGroup.MstID_Changed(null, new PropertyChangedEventArgs("_group_id"));
            }
            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._display_division_id = 1;
            }
        }
        private void GetPersonCompleted(Object sender, GetPersonCompletedEventArgs e)
        {
            try
            {
                objPerson = e.Result;
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }

                if (objPerson != null)
                {
                    if (objPerson.message != "" && objPerson.message != null)
                    {
                        // 認証失敗
                        ExMessageBox.Show(objPerson.message);
                        objPerent.DataSelect((int)geWebServiceCallKbn.GetPerson, (object)objPerson);
                    }
                    else
                    {
                        // 認証成功
                        objPerent.DataSelect((int)geWebServiceCallKbn.GetPerson, (object)objPerson);
                    }
                }
                else
                {
                    objPerent.DataSelect((int)geWebServiceCallKbn.GetPerson, null);
                }

            }
            catch (Exception ex)
            {
                this.ProcessingDlgClose();
                ExMessageBox.Show(CLASS_NM + ".GetPersonCompleted" + Environment.NewLine + ex.ToString(), "エラー確認");
            }
            finally
            {
                if (DialogCloseFlg == geDialogCloseFlg.Yes & win != null)
                {
                    win.Close();
                    win = null;
                }
            }
        }
예제 #27
0
 public StudentFamily()
 {
     Student       = new Student();
     RelatedPerson = new EntityPerson();
     RelationShip  = new RelationshipType();
 }