Exemple #1
0
        public bool Sync_Col_Info(int Pms_Com_Info_Idx, DataTable dt_PRJ_ID, string USER_REF_ID)
        {
            Dac_Pms_Com_Info dacComInfo = new Dac_Pms_Com_Info();

            DataTable PmsComInfo  = dacComInfo.Select_Pms_Com_Info(Pms_Com_Info_Idx);
            int       affectedRow = 0;



            if (PmsComInfo.Rows.Count > 0)
            {
                string srcIF_COL_ID   = PmsComInfo.Rows[0]["IF_COL_ID"].ToString();
                string srcIF_COL_NAME = PmsComInfo.Rows[0]["IF_COL_NAME"].ToString();

                string srcCUSTOM_COL_ID   = PmsComInfo.Rows[0]["CUSTOM_COL_ID"].ToString();
                string srcCUSTOM_COL_NAME = PmsComInfo.Rows[0]["CUSTOM_COL_NAME"].ToString();

                string srcSOOSIK      = PmsComInfo.Rows[0]["SOOSIK"].ToString();
                string srcSOOSIK_DESC = PmsComInfo.Rows[0]["SOOSIK_DESC"].ToString();



                string[] arrIF_COL_ID   = Remove_Escape_Blank_Char(srcIF_COL_ID).Split(',');
                string[] arrIF_COL_NAME = Remove_Escape_Blank_Char(srcIF_COL_NAME).Split(',');

                string[] arrCUSTOM_COL_ID   = Remove_Escape_Blank_Char(srcCUSTOM_COL_ID).Split(',');
                string[] arrCUSTOM_COL_NAME = Remove_Escape_Blank_Char(srcCUSTOM_COL_NAME).Split(',');



                if (arrIF_COL_ID.Length != arrIF_COL_NAME.Length)
                {
                    return(false);
                }

                if (arrCUSTOM_COL_ID.Length != arrCUSTOM_COL_NAME.Length)
                {
                    return(false);
                }



                IDbConnection conn = DbAgentHelper.CreateDbConnection();
                conn.Open();
                IDbTransaction trx = conn.BeginTransaction();

                try
                {
                    string prj_id_list = "";
                    for (int i = 0; i < dt_PRJ_ID.Rows.Count; i++)
                    {
                        if (prj_id_list.Length > 0)
                        {
                            prj_id_list += ", ";
                        }
                        prj_id_list += dt_PRJ_ID.Rows[i]["PROJECTID"].ToString();
                    }

                    Dac_Pms_Info dacPmsInfo      = new Dac_Pms_Info();
                    DataTable    dtPrjData_total = dacPmsInfo.Select_Prjdata_From_Vw(conn, trx, prj_id_list);


                    for (int i = 0; i < dt_PRJ_ID.Rows.Count; i++)
                    {
                        string PRJ_ID = dt_PRJ_ID.Rows[i]["PROJECTID"].ToString();
                        string PRJ_COL_CUSTOM_YN;



                        //기존 데이터 삭제
                        _data.Delete_Pms_Col_Info(conn, trx, PRJ_ID, "");


                        DataTable dtPrjData = DataTypeUtility.FilterSortDataTable(dtPrjData_total, string.Format("PROJECTID={0}", PRJ_ID));

                        //자동컬럼 인서트
                        for (int j = 0; j < arrIF_COL_ID.Length; j++)
                        {
                            PRJ_COL_CUSTOM_YN = "N";

                            affectedRow += Add_Pms_Col_Info(conn, trx
                                                            , PRJ_ID
                                                            , arrIF_COL_ID[j]
                                                            , arrIF_COL_NAME[j]
                                                            , PRJ_COL_CUSTOM_YN
                                                            , j + 1
                                                            , DBNull.Value
                                                            , USER_REF_ID
                                                            , dtPrjData.Rows[0]);
                        }



                        //수기컬럼 인서트
                        for (int j = 0; j < arrCUSTOM_COL_ID.Length; j++)
                        {
                            PRJ_COL_CUSTOM_YN = "Y";

                            affectedRow += Add_Pms_Col_Info(conn, trx
                                                            , PRJ_ID
                                                            , arrCUSTOM_COL_ID[j]
                                                            , arrCUSTOM_COL_NAME[j]
                                                            , PRJ_COL_CUSTOM_YN
                                                            , j + 1
                                                            , DBNull.Value
                                                            , USER_REF_ID
                                                            , dtPrjData.Rows[0]);
                        }



                        //수식 인서트
                        affectedRow += Add_Common_Soosik(conn, trx, PRJ_ID, srcSOOSIK, USER_REF_ID);

                        affectedRow += Add_Common_Soosik_Desc(conn, trx, PRJ_ID, srcSOOSIK_DESC, USER_REF_ID);
                    }

                    trx.Commit();
                }
                catch (Exception ex)
                {
                    trx.Rollback();
                    affectedRow = 0;
                }
                finally
                {
                    conn.Close();
                }
            }


            return(affectedRow > 0 ? true : false);
        }
Exemple #2
0
 public Biz_Pms_Com_Info()
 {
     _data = new Dac_Pms_Com_Info();
 }