示例#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);
        }
示例#2
0
        public int Add_Pms_Col_Info(IDbConnection conn, IDbTransaction trx
                                    , string PRJ_ID
                                    , string PRJ_COL_ID
                                    , string PRJ_COL_NAME
                                    , string PRJ_COL_CUSTOM_YN
                                    , int ORD_NUM
                                    , object PRJ_COL_VALUE
                                    , string USER_REF_ID
                                    , DataRow drPrjData)
        {
            Dac_Pms_Info dacPmsInfo = new Dac_Pms_Info();

            string COL_ID   = PRJ_COL_ID.Trim();
            string COL_NAME = PRJ_COL_NAME.Trim();

            string COL_TYPE   = Proc_Col_Type(COL_ID);
            object COL_WEIGHT = Proc_Col_Weight(COL_ID);

            object COL_VIEW      = DBNull.Value;
            object COL_NOTE      = DBNull.Value;
            object COL_SOOSIK    = DBNull.Value;
            object COL_EST_STATE = DBNull.Value;


            int affectedRow = 0;


            if (!COL_TYPE.Equals("B"))
            {
                COL_ID = COL_ID.Substring(0, COL_ID.IndexOf("("));
            }


            if (PRJ_COL_VALUE == DBNull.Value && PRJ_COL_CUSTOM_YN.Equals("N"))
            {
                if (drPrjData != null)
                {
                    PRJ_COL_VALUE = drPrjData[COL_ID];
                }
            }


            if (PRJ_COL_CUSTOM_YN.Equals("Y"))
            {
                DataTable tmpInfo = DataTypeUtility.FilterSortDataTable(etcCol_Info, string.Format("PRJ_COL_ID='{0}'", COL_ID));
                if (tmpInfo != null && tmpInfo.Rows.Count > 0)
                {
                    COL_NOTE      = tmpInfo.Rows[0]["PRJ_COL_NOTE"];
                    COL_VIEW      = tmpInfo.Rows[0]["PRJ_COL_VIEW"];
                    COL_SOOSIK    = tmpInfo.Rows[0]["PRJ_COL_SOOSIK"];
                    COL_EST_STATE = tmpInfo.Rows[0]["PRJ_COL_EST_STATE"];
                }
            }


            //인서트
            affectedRow += _data.Insert_Pms_Col_Info(conn, trx
                                                     , PRJ_ID
                                                     , COL_ID
                                                     , COL_NAME
                                                     , COL_TYPE
                                                     , PRJ_COL_CUSTOM_YN
                                                     , COL_WEIGHT
                                                     , ORD_NUM
                                                     , PRJ_COL_VALUE
                                                     , COL_NOTE
                                                     , COL_VIEW
                                                     , COL_SOOSIK
                                                     , COL_EST_STATE
                                                     , USER_REF_ID);

            return(affectedRow);
        }
示例#3
0
 public Biz_Pms_Info()
 {
     _data = new Dac_Pms_Info();
 }