コード例 #1
0
        public void List_Option(ListOption action)
        {
            fAction = action;

            switch (fAction)
            {
            case ListOption.active:

                if (chk_notactive.Checked == true)
                {
                    LoadData(CVersion_exten.NotActive());
                }
                else
                {
                    LoadData(CVersion_exten.Active());
                }

                break;

            case ListOption.notactive:

                if (chk_notactive.Checked == true)
                {
                    LoadData(CVersion_exten.NotActive());
                }
                else
                {
                    LoadData(CVersion_exten.Active());
                }

                break;

            case ListOption.Search:
                if (txt_version_name.Text != "")
                {
                    List <Version> list = new List <Version>
                    {
                        CVersion_exten.SearchName(txt_version_name.Text)
                    };
                    LoadData(list);
                }
                else
                {
                    LoadData(CVersion_exten.Active());
                }
                break;

            default:
                LoadData(CVersion_exten.Active());
                break;
            }
        }
コード例 #2
0
        public void SetAction(BtnEvent action, string pk)
        {
            fAction = action;

            switch (fAction)
            {
            case BtnEvent.Open:
                btn_save.Text = "&CLOSE";
                obj           = CVersion_exten.PKId(pk);
                this.EnableControls(false);
                break;

            case BtnEvent.New:
                btn_save.Text = "&SAVE";
                obj           = CVersion.GetNew;
                this.EnableControls(true);
                break;

            case BtnEvent.Edit:
                btn_save.Text = "&UPDATE";
                obj           = CVersion_exten.PKId(pk);
                this.EnableControls(true);
                break;

            case BtnEvent.Delete:
                btn_save.Text = "CONFIRM\r\n&DELETE";
                obj           = CVersion_exten.PKId(pk);
                this.EnableControls(false);
                break;

            case BtnEvent.Print:
                btn_save.Text = "&PRINT";
                obj           = CVersion_exten.PKId(pk);
                this.EnableControls(false);
                break;
            }

            this.LoadData();
        }
コード例 #3
0
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            //___result += "using System;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using System.Collections.Generic;\r\n";
            ___result += "using System.Drawing;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public partial class L" + UPPERFIRST + "\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [list Option]

            ___result += "        #region[list Option]\r\n";
            ___result += "\r\n";
            ___result += "        public void ListRefresh()\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(fAction);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private ListOption fAction = ListOption.active;\r\n";
            ___result += "        public void List_Option(ListOption pAction)\r\n";
            ___result += "        {\r\n";
            ___result += "            fAction = pAction;\r\n";
            ___result += "           \r\n";
            ___result += "            switch (fAction)\r\n";
            ___result += "            {\r\n";

            ___result += "                case ListOption.refer:\r\n";
            ___result += "\r\n";
            ___result += "                    if (rdo_refer.Checked == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Refer());\r\n";
            ___result += "                    }\r\n";
            ___result += "                    else\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n";
            ___result += "                    }\r\n";
            ___result += "\r\n";
            ___result += "                    break;\r\n";
            ___result += "\r\n";

            ___result += "                case ListOption.showall:\r\n";
            ___result += "\r\n";
            ___result += "                    if (rdo_showall.Checked == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Showall());\r\n";
            ___result += "                    }\r\n";
            ___result += "                    else\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n";
            ___result += "                    }\r\n";
            ___result += "\r\n";
            ___result += "                    break;\r\n";
            ___result += "\r\n";
            ___result += "                case ListOption.notactive:\r\n";
            ___result += "\r\n";
            ___result += "                    if (rdo_notactive.Checked == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Notactive());\r\n";
            ___result += "                    }\r\n";
            ___result += "                    else\r\n";
            ___result += "                    {\r\n";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n";
            ___result += "                    }\r\n";
            ___result += "\r\n";
            ___result += "                    break;\r\n";
            ___result += "\r\n";
            ___result += "                case ListOption.Search:\r\n";
            ___result += "                    LoadData(C" + UPPERFIRST + "_exten.Searchby(txt_no.Text, txt_date.Text,  txt_Todate.Text, txt_party.Text ));\r\n";
            ___result += "                    break;\r\n";
            ___result += "\r\n";
            ___result += "                default:\r\n";
            ___result += "                     LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[list Option]\r\n";
            ___result += "\r\n";

            #endregion [list Option]

            #region [Load Data]

            ___result += "        #region[Load Data]\r\n";
            ___result += "\r\n";
            ___result += "        public void LoadData(List<" + UPPERFIRST + "> list)\r\n";
            ___result += "        {\r\n";
            ___result += "        if (constructed_flag == false)\r\n";
            ___result += "        {\r\n";
            ___result += "        return;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        listgrid.SuspendLayout();\r\n";
            ___result += "\r\n";
            ___result += "            listgrid.RowCount = 0;\r\n";
            ___result += "            listgrid.RowCount = list.Count;\r\n";
            ___result += "            for (int r = 0; r < list.Count; r++)\r\n";
            ___result += "            {\r\n";
            ___result += "                DataGridViewRow row = listgrid.Rows[r];\r\n";
            ___result += "               \r\n";
            ___result += "                row.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value = list[r]." + UPPERFIRST + "_id;\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {
                    if (list[r].Inputtype == InputControls.DATEBOX)
                    {
                        ___result += "                row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = ConvertTO.Date2S(list[r]." + list[r].Fieldsname.UpperFirst() + ");\r\n";
                    }
                    else if (list[r].Inputtype == InputControls.DATETIMEBOX)
                    {
                        ___result += "                row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = ConvertTO.DateTime12S(list[r]." + list[r].Fieldsname.UpperFirst() + ");\r\n";
                    }
                    else
                    {
                        ___result += "                row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = list[r]." + list[r].Fieldsname.UpperFirst() + ";\r\n";
                    }
                }
            }
            //___result += "                row.Cells[" + CAPITAL + ".NOTES].Value = list[r].Notes;\r\n";
            //___result += "                row.Cells[" + CAPITAL + ".ACTIVE_ID].Value = list[r].Active_id;\r\n";
            ___result += "                row.Cells[" + CAPITAL + ".USER_ID].Value = list[r].User_id;\r\n";
            ___result += "\r\n";
            ___result += "                switch (list[r].Locked)\r\n";
            ___result += "                {\r\n";
            ___result += "                    case Core.Locked:\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(0, 152, 70);\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.ForeColor = Color.White;\r\n";
            ___result += "                        row.Cells[GRID.CELL].Value = Core.Txt_Locked;\r\n";
            ___result += "                        break;\r\n";
            ___result += "                    case Core.Partial:\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(255, 237, 0);\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.ForeColor = Color.FromArgb(0, 141, 210);\r\n";
            ___result += "                        row.Cells[GRID.CELL].Value = Core.Txt_Partial;\r\n";
            ___result += "\r\n";
            ___result += "                        break;\r\n";
            ___result += "                    default:\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(227, 30, 36);\r\n";
            ___result += "                        row.Cells[GRID.CELL].Style.ForeColor = Color.White;\r\n";
            ___result += "                        row.Cells[GRID.CELL].Value = Core.Txt_Unlocked;\r\n";
            ___result += "                        break;\r\n";
            ___result += "                }\r\n";
            ___result += "\r\n";
            ___result += "                listgrid.Refresh();\r\n";
            ___result += "                if (listgrid.RowCount != 0)\r\n";
            ___result += "                {\r\n";
            ___result += "                    listgrid.CurrentCell = listgrid[" + CAPITAL + ".PARTY_ID, listgrid.RowCount - 1];\r\n";
            ___result += "                }\r\n";
            ___result += "                }\r\n";
            ___result += "                listgrid.ResumeLayout(true);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Load Data]\r\n";
            ___result += "\r\n";
            #endregion [Load Data]

            #region [finally return]

            ___result += "\r\n";
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [Finally return]
        }
コード例 #4
0
ファイル: SForm.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List<SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region[using ]

            ___result += "using System;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using System.Drawing;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using CXCORE;\r\n";
            ___result += "\r\n";
            ___result += "\r\n";

            #endregion[using ]

            #region[namespace ]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class F" + UPPERFIRST + " : UserControl \r\n";
            ___result += "    { \r\n";
            ___result += "\r\n";

            #endregion[namespace ]

            #region[Split Timer]

            ___result += "        #region[Split Timer]\r\n";
            ___result += "\r\n";
            ___result += "        private bool expand;\r\n";
            ___result += "\r\n";
            ___result += "        private void SplitTimer_Tick(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (expand)\r\n";
            ___result += "            {\r\n";
            ___result += "                if (split_container.SplitterDistance < Convert.ToInt32(ClientSize.Width) - 29)\r\n";
            ___result += "                {\r\n";
            ___result += "                    split_container.SplitterDistance += 50;\r\n";
            ___result += "                }\r\n";
            ___result += "                else\r\n";
            ___result += "                {\r\n";
            ___result += "                    btn_splitter.Text = \"⁞⁞\";\r\n";
            ___result += "                    expand = false;\r\n";
            ___result += "                    splitTimer.Stop();\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "            else\r\n";
            ___result += "            {\r\n";
            ___result += "                if (split_container.SplitterDistance > Convert.ToInt32(ClientSize.Width) - 150)\r\n";
            ___result += "                {\r\n";
            ___result += "                    split_container.SplitterDistance += -50;\r\n";
            ___result += "                }\r\n";
            ___result += "                else\r\n";
            ___result += "                {\r\n";
            ___result += "                    btn_splitter.Text = \">>\";\r\n";
            ___result += "                    expand = true;\r\n";
            ___result += "                    splitTimer.Stop();\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "        private void Btn_splitter_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            splitTimer.Enabled = true;\r\n";
            ___result += "        }\r\n";
            ___result += "        private void Btn_close_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            Hide();\r\n";
            ___result += "            Form_NeedToRefresh();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Split Timer]\r\n";
            ___result += "\r\n";

            #endregion [btn Split Timer]

            #region[Enter Event]

            ___result += "        #region[Enter Event]\r\n";
            ___result += "\r\n";
            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {

                    ___result += "        private void Txt_" + list[r].Fieldsname.ToLower() + "_Enter(object sender, EventArgs e)\r\n";
                    ___result += "        {\r\n";
                    ___result += "            Change_infocus();\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".BackColor = Theme.lbl_EnterBackColor;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".BorderColor = Theme.lbl_EnterBorderColor;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".ForeColor = Theme.lbl_EnterForeColor;\r\n";
                    ___result += "        }\r\n";
                }
            }
            ___result += "        private void Txt_notes_Enter(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            Change_infocus();\r\n";
            ___result += "            lbl_notes.BackColor = Theme.lbl_EnterBackColor;\r\n";
            ___result += "            lbl_notes.BorderColor = Theme.lbl_EnterBorderColor;\r\n";
            ___result += "            lbl_notes.ForeColor = Theme.lbl_EnterForeColor;\r\n";
            ___result += "        }\r\n";
            ___result += "        private void Change_infocus()\r\n";
            ___result += "        {\r\n";
            ___result += "            \r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".BackColor = Theme.lbl_BackColor;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".BorderColor = Theme.lbl_BorderColor;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".ForeColor = Theme.lbl_ForeColor;\r\n";
                    ___result += "            \r\n";
                }
            }

            ___result += "            lbl_notes.BackColor = Theme.lbl_BackColor;\r\n";
            ___result += "            lbl_notes.BorderColor = Theme.lbl_BorderColor;\r\n";
            ___result += "            lbl_notes.ForeColor = Theme.lbl_ForeColor;\r\n";
            ___result += "            \r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Enter Event]\r\n";
            ___result += "\r\n";

            #endregion[Enter Event]

            #region[btn Event ]

            ___result += "        #region[Btn Event ]\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_active_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            ToggleActive();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_save_click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            Save_Event();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_list_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            splitTimer.Enabled = true;\r\n";
            ___result += "            this.Hide();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_new_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            splitTimer.Enabled = true;\r\n";
            ___result += "            SetAction(BtnEvent.New, null);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_edit_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (vId != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                splitTimer.Enabled = true;\r\n";
            ___result += "                SetAction(BtnEvent.Edit, vId);\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_delete_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (vId != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                splitTimer.Enabled = true;\r\n";
            ___result += "                SetAction(BtnEvent.Delete, vId);\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_print_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (vId != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                splitTimer.Enabled = true;\r\n";
            ___result += "                SetAction(BtnEvent.Print, vId);\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Btn Event ]\r\n";
            ___result += "\r\n";

            #endregion[btn Event ]

            #region[Lbl Event]

            ___result += "        #region[Lbl Event ]\r\n";
            ___result += "\r\n";
            ___result += "        private void Lbl_notes_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            txt_notes.Refresh();\r\n";
            ___result += "            if (txt_notes.Height == 600)\r\n";
            ___result += "            {\r\n";
            ___result += "                txt_notes.BackColor = Color.White;\r\n";
            ___result += "                txt_notes.Width = Theme.F_txt_notes_width - 100;\r\n";
            ___result += "                txt_notes.Height = Theme.F_txt_notes_height;\r\n";
            ___result += "                txt_notes.Location = new Point(Theme.txt_left, Theme.Fpanel_height - 75);\r\n";
            ___result += "            }\r\n";
            ___result += "            else if (txt_notes.Height == Theme.F_txt_notes_height)\r\n";
            ___result += "            {\r\n";
            ___result += "                txt_notes.Location = new Point(lbl_notes.Right - 1, 137);\r\n";
            ___result += "                txt_notes.Width = 1170;\r\n";
            ___result += "                txt_notes.Height = 600;\r\n";
            ___result += "                txt_notes.BackColor = Color.FromArgb(255, 255, 192);\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Lbl Event ]\r\n";
            ___result += "\r\n";

            #endregion[Lbl Event]

            #region [Active Event]

            ___result += "        #region[Active Event ]\r\n";
            ___result += "\r\n";
            ___result += "        private void ToggleActive()\r\n";
            ___result += "        {\r\n";
            ___result += "            if (btn_active.Text != Core.ACTIVE_TXT)\r\n";
            ___result += "            {\r\n";
            ___result += "                btn_active.Themes = Themescheme.Green;\r\n";
            ___result += "                btn_active.Text = Core.ACTIVE_TXT;\r\n";
            ___result += "                Core.Stative = Core.Active;\r\n";
            ___result += "            }\r\n";
            ___result += "            else\r\n";
            ___result += "            {\r\n";
            ___result += "                btn_active.Themes = Themescheme.RED;\r\n";
            ___result += "                btn_active.Text = Core.NOTACTIVE_TXT;\r\n";
            ___result += "                Core.Stative = Core.NotActive;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Setactives()\r\n";
            ___result += "        {\r\n";
            ___result += "            if (Core.Stative == Core.Active)\r\n";
            ___result += "            {\r\n";
            ___result += "                btn_active.Themes = Themescheme.Green;\r\n";
            ___result += "                btn_active.Text = Core.ACTIVE_TXT;\r\n";
            ___result += "                btn_save.Focus();\r\n";
            ___result += "                this.Refresh();\r\n";
            ___result += "            }\r\n";
            ___result += "            else if (Core.Stative == Core.NotActive)\r\n";
            ___result += "            {\r\n";
            ___result += "                btn_active.Themes = Themescheme.RED;\r\n";
            ___result += "                btn_active.Text = Core.NOTACTIVE_TXT;\r\n";
            ___result += "                this.Refresh();\r\n";
            ___result += "            }\r\n";
            ___result += "            else if (Core.Stative == Core.Idle)\r\n";
            ___result += "            {\r\n";
            ___result += "                btn_active.Themes = Themescheme.WHITE;\r\n";
            ___result += "                btn_active.Text = Core.IDLE_TXT;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Active Event ]\r\n";
            ___result += "\r\n";

            #endregion [Active Event]

            #region [RaiseEvent]

            ___result += "        #region[Raise Event ]\r\n";
            ___result += "\r\n";
            ___result += "        public event EventHandler F" + UPPERFIRST + "_NeedToRefresh;\r\n";
            ___result += "\r\n";
            ___result += "        public void Form_NeedToRefresh()\r\n";
            ___result += "        {\r\n";
            ___result += "            if (F" + UPPERFIRST + "_NeedToRefresh != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                F" + UPPERFIRST + "_NeedToRefresh(this, new EventArgs());\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Raise Event ]\r\n";
            ___result += "\r\n";

            #endregion [RaiseEvent]

            #region[Lookup]

            for (int r = 0; r < list.Count; r++)
            {
                if ((list[r].Inputtype == InputControls.LOOKUPBOX) || (list[r].Inputtype == InputControls.LOOKUPBOX_FIRST))
                {
                    string xTRIMTABLE = list[r].Fieldsname.ToUpper().Replace("_ID","");
                    string xCAPITAL = ChangeCase.ToUpper(xTRIMTABLE);
                    string xSMALL = ChangeCase.ToLower(xTRIMTABLE);
                    string xUPPERFIRST = ChangeCase.UpperFirst(xSMALL);

                    string _field = string.Empty;

                    //List<structure> _structure = cStructure_exten.GetTableFromreal(xDATABASE, xTABLENAME);

                    //_field = _structure[1].field;

                    ___result += "        #region[" + xUPPERFIRST + " Lookup]\r\n";
                    ___result += "\r\n";
                    ___result += "        public void " + xUPPERFIRST + "_lookup() \r\n";
                    ___result += "        { \r\n";
                    ___result += "            txt_" + xSMALL + "_id.LookupColNames = new string[] {" + xCAPITAL + "." + xCAPITAL + "_NAME }; \r\n";
                    ___result += "            txt_" + xSMALL + "_id.LookupUpdate += txt_" + xSMALL + "_LookupUpdate; \r\n";
                    ___result += "            txt_" + xSMALL + "_id.AllowNewEntry = true; \r\n";
                    ___result += "            txt_" + xSMALL + "_id.NewEntryNeeded += txt_" + xSMALL + "_NewEntryNeeded; \r\n";
                    ___result += "        } \r\n";
                    ___result += "        void txt_" + xSMALL + "_LookupUpdate(object sender, EventArgs e) \r\n";
                    ___result += "        { \r\n";
                    ___result += "            txt_" + xSMALL + "_id.LookupList = C" + xUPPERFIRST + "_exten.GetforLookup(new " + xDAL + "()); \r\n";
                    ___result += "        } \r\n";
                    ___result += "        private F" + xUPPERFIRST + " x" + xSMALL + " = null; \r\n";
                    ___result += "        void txt_" + xSMALL + "_NewEntryNeeded(object sender, string pValue) \r\n";
                    ___result += "        { \r\n";
                    ___result += "            if (x" + xSMALL + " == null) \r\n";
                    ___result += "            { \r\n";
                    ___result += "                x" + xSMALL + " = new F" + xUPPERFIRST + "(); \r\n";
                    ___result += "                x" + xSMALL + ".F" + xUPPERFIRST + "_NeedToRefresh += " + xUPPERFIRST + "_NeedToRefresh; \r\n";
                    ___result += "            } \r\n";
                    ___result += "            this.Parent.Controls.Add(x" + xSMALL + "); \r\n";
                    ___result += "            x" + xSMALL + ".Dock = DockStyle.Fill; \r\n";
                    ___result += "            x" + xSMALL + ".Show(); \r\n";
                    ___result += "            x" + xSMALL + ".BringToFront(); \r\n";
                    ___result += "            x" + xSMALL + ".Focus(); \r\n";
                    ___result += "               \r\n";
                    ___result += "            x" + xSMALL + ".SetAction(BtnEvent.New, null); \r\n";
                    ___result += "            x" + xSMALL + ".SetFocus(); \r\n";
                    ___result += "            x" + xSMALL + ".setname(pValue); \r\n";
                    ___result += "        } \r\n";
                    ___result += "        void " + xUPPERFIRST + "_NeedToRefresh(object sender, EventArgs e) \r\n";
                    ___result += "        { \r\n";
                    ___result += "            txt_" + xSMALL + "_id.Text = x" + xSMALL + ".GetName(); \r\n";

                    if (r + 1 < list.Count)
                    {
                        ___result += "            txt_" + list[r + 1].Fieldsname.ToLower() + ".Focus(); \r\n";
                    }
                    else
                    {
                        ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Focus(); \r\n";
                    }


                    ___result += "        } \r\n";
                    ___result += "\r\n";
                    ___result += "        #endregion[" + xUPPERFIRST + "Lookup]\r\n";
                    ___result += "\r\n";
                }
            }

            #endregion[Lookup]

            #region[Set Focus]

            ___result += "        #region[Set Focus]\r\n";
            ___result += "\r\n";
            ___result += "        public void SetFocus()\r\n";
            ___result += "        {\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Isdefault == AutoCode.YES)
                {
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Focus();\r\n";
                }
            }
            ___result += "        }\r\n";
            ___result += "        #endregion[Set Focus]\r\n";
            ___result += "\r\n";

            #endregion[Set Focus]

            #region[result]

            ___result += "}//cls \r\n";
            ___result += "}//ns \r\n";

            return ___result;

            #endregion[result]

        }
コード例 #5
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = ChangeCase.ToUpper(TRIM_TBL);
            string SMALL      = ChangeCase.ToLower(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);

            string ___result = "";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";
            #endregion [Conclusion]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";

            #endregion [namespace]

            #region [string Properties]

            ___result += "    #region[Properties]\r\n";
            ___result += "\r\n";
            ___result += "    public class " + UPPERFIRST + "\r\n";
            ___result += "    {\r\n";
            ___result += "        public string " + UPPERFIRST + "_id { get; set; }\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.INT:
                    ___result += "        public int " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "        public decimal " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "        public decimal " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                default:
                    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;
                }
            }
            ___result += "        public string Notes { get; set; }\r\n";
            ___result += "        public string Active_id { get; set; }\r\n";
            ___result += "        public string User_id { get; set; }\r\n";
            ___result += "    }\r\n";
            ___result += "\r\n";
            ___result += "    #endregion[Properties]\r\n";
            ___result += "\r\n";

            #endregion [string Properties]

            #region [string Const class]

            ___result += "    #region[Const]\r\n";
            ___result += "\r\n";
            ___result += "    public static class " + CAPITAL + "\r\n";
            ___result += "    {\r\n";
            ___result += "        public const string " + CAPITAL + "_ID = \"" + CAPITAL + "_ID\";\r\n";
            for (int r = 0; r < list.Count; r++)
            {
                ___result += "        public const string " + list[r].Fieldsname.ToUpper() + " = \"" + list[r].Fieldsname.ToUpper() + "\";\r\n";
            }

            ___result += "        public const string NOTES = \"NOTES\";\r\n";
            ___result += "        public const string ACTIVE_ID = \"ACTIVE_ID\";\r\n";
            ___result += "        public const string USER_ID = \"USER_ID\";\r\n";
            ___result += "\r\n";
            ___result += "        public const string " + TABLENAME.ToUpper() + " = \"" + TABLENAME.ToUpper() + "\";\r\n";
            ___result += "    }\r\n";
            ___result += "\r\n";
            ___result += "    #endregion[Const]\r\n";
            ___result += "\r\n";
            ___result += "}//ns\r\n";

            #endregion [string Const class]

            #region [result]

            return(___result);
        }
コード例 #6
0
        //
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = ChangeCase.ToUpper(TRIM_TBL);
            string SMALL      = ChangeCase.ToLower(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);

            string ___result = "";

            string xDAL = "SQLITE_DAL";

            //
            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            //___result += "using System.Collections.Generic;\r\n";
            //___result += "using System.Data;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class C" + UPPERFIRST + "\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Get New]

            ___result += "\r\n";
            ___result += "        #region[Get New]\r\n";
            ___result += "\r\n";
            ___result += "        public static " + UPPERFIRST + " GetNew\r\n";
            ___result += "        {\r\n";
            ___result += "            get\r\n";
            ___result += "            {\r\n";
            ___result += "                " + UPPERFIRST + " obj = new " + UPPERFIRST + "()\r\n";
            ___result += "                {\r\n";
            ___result += "                    " + UPPERFIRST + "_id = string.Empty,\r\n";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.INT:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = 0,\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = decimal.Zero,\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = decimal.Zero,\r\n";
                    break;

                default:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = string.Empty,\r\n";
                    break;
                }
            }

            ___result += "                    Notes = string.Empty,\r\n";
            ___result += "                    Active_id = Core.Active,\r\n";
            ___result += "                    User_id = Current.User\r\n";
            ___result += "                };\r\n";
            ___result += "                return obj;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Get New]\r\n";
            ___result += "\r\n";

            #endregion [Get New]

            #region [Attach params ]

            ___result += "        #region[Attach params]\r\n";
            ___result += "\r\n";
            ___result += "        private static string AttachParams(string q, " + UPPERFIRST + " v)\r\n";
            ___result += "        {\r\n";
            ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "." + CAPITAL + "_ID + \"@\", \"\" + ConvertTO.SqlString(v." + UPPERFIRST + "_id) + \"\");\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                string sqlstr = "";

                switch (list[r].Datatype)
                {
                case DATATYPES.DATE:
                    sqlstr = "SqlDate";
                    break;

                case DATATYPES.DATETIME:
                    sqlstr = "SqlDateTime";
                    break;

                case DATATYPES.INT:
                    sqlstr = "SqlInt";
                    break;

                case DATATYPES.DECMIAL_2:
                    sqlstr = "SqlDecimal";
                    break;

                case DATATYPES.DECMIAL_3:
                    sqlstr = "SqlDecimal";
                    break;

                default:
                    sqlstr = "SqlString";
                    break;
                }

                ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO." + sqlstr + "(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
            }
            ___result += "            q = q.Replace(\"@\" + " + CAPITAL + ".NOTES + \"@\", \"\" + ConvertTO.SqlString(v.Notes) + \"\");\r\n";
            ___result += "            q = q.Replace(\"@\" + " + CAPITAL + ".ACTIVE_ID + \"@\", \"\" + ConvertTO.SqlString(v.Active_id) + \"\");\r\n";
            ___result += "            q = q.Replace(\"@\" + " + CAPITAL + ".USER_ID + \"@\", \"\" + ConvertTO.SqlString(v.User_id) + \"\");\r\n";
            ___result += "            return q;\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Attach params]\r\n";
            ___result += "\r\n";

            #endregion [Attach params ]

            #region [Insert Query]

            ___result += "        #region[Insert]\r\n";
            ___result += "\r\n";
            ___result += "        public static void Insert(" + UPPERFIRST + " v, " + xDAL + " dalsession)\r\n";
            ___result += "        {\r\n";
            ___result += "                string q = \" INSERT INTO \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" ( \";\r\n";
            ___result += "                q += \" \" + " + CAPITAL + "." + list[0].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n";

            for (int r = 1; r < list.Count; r++)
            {
                ___result += "                q += \",\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n";
            }
            ___result += "                q += \",\" + " + CAPITAL + ".NOTES + \" \\r\\n \";\r\n";
            ___result += "                q += \",\" + " + CAPITAL + ".ACTIVE_ID + \" \\r\\n \";\r\n";
            ___result += "                q += \",\" + " + CAPITAL + ".USER_ID + \" \\r\\n \";\r\n";
            ___result += "                q += \" ) VALUES ( \";\r\n";
            ___result += "                q += \"  @\"+ " + CAPITAL + "." + list[0].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";

            for (int r = 1; r < list.Count; r++)
            {
                ___result += "                q += \", @\"+ " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";
            }

            ___result += "                q += \", @\"+ " + CAPITAL + ".NOTES + \"@ \\r\\n \";\r\n";
            ___result += "                q += \", @\"+ " + CAPITAL + ".ACTIVE_ID + \"@ \\r\\n \";\r\n";
            ___result += "                q += \", @\"+ " + CAPITAL + ".USER_ID + \"@ \\r\\n \";\r\n";
            ___result += "                q += \" ) \\r\\n \";\r\n";
            ___result += "                q = AttachParams(q, v);\r\n";
            ___result += "                dalsession.Execute(q);\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Insert]\r\n";
            ___result += "\r\n";

            #endregion [Insert Query]

            #region [Update query]

            ___result += "        #region[Update]\r\n";
            ___result += "\r\n";
            ___result += "        public static void Update(" + UPPERFIRST + " v, " + xDAL + " dalsession)\r\n";
            ___result += "        {\r\n";
            ___result += "                string q = \"UPDATE \" + " + CAPITAL + "." + TABLENAME + " + \" SET\";\r\n";

            ___result += "                q += " + "\" \" + " + CAPITAL + "." + list[0].Fieldsname.ToUpper() + " + \" = @\" + " + CAPITAL + "." + list[0].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";

            for (int r = 1; r < list.Count; r++)
            {
                ___result += "                q += " + "\",\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = @\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";
            }

            ___result += "                q += " + "\",\" + " + CAPITAL + ".NOTES + \" = @\" + " + CAPITAL + ".NOTES + \"@ \\r\\n \";\r\n";
            ___result += "                q += " + "\",\" + " + CAPITAL + ".ACTIVE_ID + \" = @\" + " + CAPITAL + ".ACTIVE_ID + \"@ \\r\\n \";\r\n";
            ___result += "                q += " + "\",\" + " + CAPITAL + ".USER_ID + \" = @\" + " + CAPITAL + ".USER_ID + \"@ \\r\\n \";\r\n";
            ___result += "                q += \"  WHERE \" + " + CAPITAL + "." + CAPITAL + "_ID + \" = @\" + " + CAPITAL + "." + CAPITAL + "_ID + \"@ \";\r\n";
            ___result += "                q = AttachParams(q, v);\r\n";
            ___result += "                dalsession.Execute(q);\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Update]\r\n";
            ___result += "\r\n";

            #endregion [Update query]

            #region [Build delete query]

            ___result += "        #region[Delete]\r\n";
            ___result += "\r\n";
            ___result += "        public static void Delete(string pkid , " + xDAL + " dalsession)\r\n";;
            ___result += "        {\r\n";
            ___result += "                dalsession.Execute(\"DELETE FROM  \" + " + CAPITAL + "." + TABLENAME + "+ \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_ID + \" =  \" + pkid +\";\");\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Delete]\r\n";
            ___result += "\r\n";

            #endregion [delete query]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #7
0
ファイル: SForm_Default.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// " + DateTime.Now + "\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]
            //
            #region [Designer]
            //
            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "        { \r\n";
            ___result += "        public partial class F" + UPPERFIRST + "\r\n";
            ___result += "        {\r\n";
            ___result += "        private System.ComponentModel.IContainer components = null; \r\n";
            ___result += "        \r\n";
            ___result += "        protected override void Dispose(bool disposing) \r\n";
            ___result += "        {\r\n";
            ___result += "            if (disposing && (components != null)) \r\n";
            ___result += "            {\r\n";
            ___result += "            components.Dispose(); \r\n";
            ___result += "            }\r\n";
            ___result += "            base.Dispose(disposing); \r\n";
            ___result += "        }\r\n";
            ___result += "        \r\n";
            //___result += "         #region [InitializeComponent] \r\n";
            ___result += "        \r\n";
            ___result += "        private void InitializeComponent() \r\n";
            ___result += "        {\r\n";
            ___result += "            components = new System.ComponentModel.Container();\r\n";
            ___result += "            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n";
            ___result += "        } \r\n";
            ___result += "        \r\n";
            //___result += "        #endregion [InitializeComponent] \r\n";
            //
            #endregion [Designer]
            //
            #region [result]
            //
            ___result += "    }//cls \r\n";
            ___result += "}//ns \r\n";
            //
            return(___result);

            //
            #endregion [result]
            //
        }
コード例 #8
0
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System;\r\n";
            ___result += "using System.Drawing;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public partial class L" + UPPERFIRST + "\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region []

            ___result += "\r\n";
            ___result += "          private F" + UPPERFIRST + " f" + SMALL + " = null;\r\n";
            ___result += "          private bool constructed_flag = false;\r\n";
            ___result += "\r\n";
            ___result += "         public L" + UPPERFIRST + "()\r\n";
            ___result += "         {\r\n";
            ___result += "             InitializeComponent();\r\n";
            ___result += "             Initialize();\r\n";
            ___result += "             InitGrid();\r\n";
            ___result += "             List_Option(ListOption.active);\r\n";
            ___result += "             No_lookup();\r\n";
            //___result += "             Date_lookup();\r\n";
            ___result += "             Party_lookup();\r\n";
            //___result += "             Getno_panel.Visible = false;\r\n";
            ___result += "             constructed_flag = true;\r\n";
            ___result += "             rdo_unrefer.Checked = true;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";

            #endregion []

            #region [Private Declare]

            ___result += "        #region[Private Declare]\r\n";
            ___result += "\r\n";
            ___result += "        private XShadowPanel lpanel;\r\n";
            ___result += "        private Panel linner_panel;\r\n";
            ___result += "        private CloseButton btn_close;\r\n";
            ___result += "        private Header lbl_header;\r\n";
            ___result += "\r\n";
            ___result += "        private XLabel lbl_no;\r\n";
            ___result += "        private LookupBox txt_no;\r\n";
            ___result += "        private XLabel lbl_date;\r\n";
            ___result += "        private xDatepicker txt_datePicker;\r\n";
            ___result += "        private XTextBox txt_date;\r\n";
            ___result += "        private XLabel lbl_dateTo;\r\n";
            ___result += "        private xDatepicker txt_TodatePicker;\r\n";
            ___result += "        private XTextBox txt_Todate;\r\n";
            ___result += "        private XLabel lbl_party;\r\n";
            ___result += "        private LookupBox txt_party;\r\n";
            ___result += "        private OfficeButton btn_search;\r\n";
            ___result += "\r\n";
            ___result += "        private MRadioButton rdo_unrefer;\r\n";
            ___result += "        private MRadioButton rdo_refer;\r\n";
            ___result += "        private MRadioButton rdo_showall;\r\n";
            ___result += "        private MRadioButton rdo_notactive;\r\n";
            ___result += "\r\n";
            //___result += "        private OfficeButton btn_quick;\r\n";
            //___result += "        private Panel Getno_panel;\r\n";
            //___result += "        private ShadowBox Getno_innerpanel;\r\n";
            //___result += "        private XTextBox txt_getno;\r\n";
            //___result += "        private XLabel lbl_getno;\r\n";
            //___result += "        private OfficeButton btn_generate;\r\n";
            //___result += "\r\n";
            ___result += "        private OfficeButton btn_refresh;\r\n";
            ___result += "        private OfficeButton btn_new;\r\n";
            ___result += "        private OfficeButton btn_edit;\r\n";
            ___result += "        private OfficeButton btn_delete;\r\n";
            ___result += "        private OfficeButton btn_print;\r\n";
            ___result += "\r\n";
            ___result += "        private ListGridView listgrid;\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Private Declare]\r\n";
            ___result += "\r\n";

            #endregion [Private Declare]

            #region [Initialize]

            ___result += "        #region[Initialize]\r\n";
            ___result += "\r\n";
            ___result += "        private void Initialize()\r\n";
            ___result += "        {\r\n";
            ___result += "\r\n";
            ___result += "            lpanel = new XShadowPanel();\r\n";
            ___result += "            linner_panel = new Panel();\r\n";
            ___result += "            btn_close = new CloseButton();\r\n";
            ___result += "            lbl_header = new Header();\r\n";
            ___result += "\r\n";
            ___result += "            rdo_unrefer = new MRadioButton();\r\n";
            ___result += "            rdo_refer = new MRadioButton();\r\n";
            ___result += "            rdo_showall = new MRadioButton();\r\n";
            ___result += "            rdo_notactive = new MRadioButton();\r\n";
            ___result += "\r\n";
            ___result += "            txt_no = new LookupBox();\r\n";
            ___result += "            lbl_no = new XLabel();\r\n";
            ___result += "            txt_date = new XTextBox();\r\n";
            ___result += "            txt_datePicker = new xDatepicker();\r\n";
            ___result += "            lbl_date = new XLabel();\r\n";
            ___result += "            txt_Todate = new XTextBox();\r\n";
            ___result += "            txt_TodatePicker = new xDatepicker();\r\n";
            ___result += "            lbl_dateTo = new XLabel();\r\n";
            ___result += "            txt_party = new LookupBox();\r\n";
            ___result += "            lbl_party = new XLabel();\r\n";
            ___result += "            btn_search = new OfficeButton();\r\n";
            //___result += "\r\n";
            //___result += "            btn_quick = new OfficeButton();\r\n";
            //___result += "            Getno_panel = new Panel();\r\n";
            //___result += "            Getno_innerpanel = new ShadowBox();\r\n";
            //___result += "            txt_getno = new XTextBox();\r\n";
            //___result += "            lbl_getno = new XLabel();\r\n";
            //___result += "            btn_generate = new OfficeButton();\r\n";
            ___result += "\r\n";
            ___result += "            btn_refresh = new OfficeButton();\r\n";
            ___result += "            btn_new = new OfficeButton();\r\n";
            ___result += "            btn_edit = new OfficeButton();\r\n";
            ___result += "            btn_delete = new OfficeButton();\r\n";
            ___result += "            btn_print = new OfficeButton();\r\n";
            ___result += "\r\n";
            ___result += "            listgrid = new ListGridView();\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();\r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();\r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();\r\n";
            ___result += "\r\n";
            ___result += "            lpanel.SuspendLayout();\r\n";
            ___result += "            linner_panel.SuspendLayout();\r\n";
            ___result += "            ((System.ComponentModel.ISupportInitialize)(listgrid)).BeginInit();\r\n";
            ___result += "            SuspendLayout();\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Location = XLayout.LInnerPanel;\r\n";
            ___result += "            linner_panel.Name = \"linner_panel\";\r\n";
            ___result += "            linner_panel.Size = XSize.LInnerPanel;\r\n";
            ___result += "\r\n";
            ___result += "            btn_close.Click += Btn_close_Click;\r\n";
            ___result += "\r\n";
            ___result += "            lbl_header.Text = \"" + (obj.STables.Alias.Replace("_", " ")).UpperFirst() + "\";\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Initialize]\r\n";
            ___result += "\r\n";

            #endregion [Initialize]

            #region [Add Control]

            ___result += "            #region[Add Control]\r\n";
            ___result += "\r\n";
            ___result += "            lpanel.Name = \"lpanel\";\r\n";
            ___result += "            lpanel.Dock = DockStyle.Fill;\r\n";
            ___result += "            lpanel.Size = XSize.FPanel;\r\n";
            ___result += "            lpanel.Location = XLayout.FPanel;\r\n";
            ___result += "            lpanel.BackColor = XTheme.FPanel;\r\n";
            ___result += "            lpanel.Controls.Add(linner_panel);\r\n";
            ___result += "            lpanel.Controls.Add(btn_close);\r\n";
            ___result += "            lpanel.Controls.Add(lbl_header);\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Anchor = XAnchor.LTRB;\r\n";
            ___result += "            linner_panel.BackColor = XTheme.LInnerpanel;\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Controls.Add(txt_no);\r\n";
            ___result += "            linner_panel.Controls.Add(lbl_no);\r\n";
            ___result += "            linner_panel.Controls.Add(txt_date);\r\n";
            ___result += "            linner_panel.Controls.Add(txt_datePicker);\r\n";
            ___result += "            linner_panel.Controls.Add(lbl_date);\r\n";
            ___result += "            linner_panel.Controls.Add(txt_Todate);\r\n";
            ___result += "            linner_panel.Controls.Add(txt_TodatePicker);\r\n";
            ___result += "            linner_panel.Controls.Add(lbl_dateTo);\r\n";

            ___result += "            linner_panel.Controls.Add(txt_party);\r\n";
            ___result += "            linner_panel.Controls.Add(lbl_party);\r\n";
            ___result += "            linner_panel.Controls.Add(btn_search);\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Controls.Add(rdo_unrefer);\r\n";
            ___result += "            linner_panel.Controls.Add(rdo_refer);\r\n";
            ___result += "            linner_panel.Controls.Add(rdo_showall);\r\n";
            ___result += "            linner_panel.Controls.Add(rdo_notactive);\r\n";
            //___result += "\r\n";
            //___result += "            linner_panel.Controls.Add(btn_quick);\r\n";
            //___result += "            linner_panel.Controls.Add(Getno_panel);\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Controls.Add(btn_refresh);\r\n";
            ___result += "            linner_panel.Controls.Add(btn_new);\r\n";
            ___result += "            linner_panel.Controls.Add(btn_edit);\r\n";
            ___result += "            linner_panel.Controls.Add(btn_delete);\r\n";
            ___result += "            linner_panel.Controls.Add(btn_print);\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Controls.Add(listgrid);\r\n";


            ___result += "\r\n";
            ___result += "            #endregion[Add Control]\r\n";
            ___result += "\r\n";

            #endregion [Add Control]

            #region [Search]

            ___result += "            #region[Search]\r\n";
            ___result += "\r\n";
            ___result += "            lbl_no.Font = XFont.Font_10B;\r\n";
            ___result += "            lbl_no.Name = \"lbl_no\";\r\n";
            ___result += "            lbl_no.Text = \"No\";\r\n";
            ___result += "            lbl_no.TextAlign = ContentAlignment.MiddleCenter;\r\n";
            ___result += "            lbl_no.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            ___result += "            lbl_no.Size = new Size(40, 28);\r\n";
            ___result += "            lbl_no.Location = XLayout.FirstLabel;\r\n";
            ___result += "\r\n";
            ___result += "            txt_no.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_no.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_no.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_no.Name = \"txt_no\";\r\n";
            ___result += "            txt_no.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n";
            ___result += "            txt_no.Size = new Size(120, 28);\r\n";
            ___result += "            txt_no.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_no.Location = new Point(lbl_no.Right - 1, lbl_no.Top);\r\n";
            ___result += "            txt_no.TabIndex = 6;\r\n";
            ___result += "\r\n";


            ___result += "            lbl_date.Font = XFont.Font_10B;\r\n";
            ___result += "            lbl_date.Name = \"lbl_date\";\r\n";
            ___result += "            lbl_date.Text = \"Date\";\r\n";
            ___result += "            lbl_date.TextAlign = ContentAlignment.MiddleCenter;\r\n";
            ___result += "            lbl_date.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            ___result += "            lbl_date.Size = new Size(50, 28);\r\n";
            ___result += "            lbl_date.Location = new Point(txt_no.Right + 10, txt_no.Top);\r\n";
            ___result += "\r\n";
            ___result += "            txt_date.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_date.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_date.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_date.Name = \"txt_date\";\r\n";
            ___result += "            txt_date.Size = new Size(140, 28);\r\n";
            ___result += "            txt_date.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_date.Location = new Point(lbl_date.Right - 1, lbl_date.Top);\r\n";
            ___result += "            txt_date.TabIndex = 7;\r\n";
            ___result += "\r\n";
            ___result += "            txt_datePicker.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_datePicker.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_datePicker.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_datePicker.Name = \"txt_datePicker\";\r\n";
            ___result += "            txt_datePicker.CustomFormat = \"  dd -MM-yyyy\";\r\n";
            ___result += "            txt_datePicker.Format = DateTimePickerFormat.Custom;\r\n";
            ___result += "            txt_datePicker.Size = new Size(170, 28);\r\n";
            ___result += "            txt_datePicker.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_datePicker.Location = new Point(lbl_date.Right - 1, lbl_date.Top);\r\n";
            ___result += "            txt_datePicker.TabIndex = 7;\r\n";
            ___result += "            txt_datePicker.TextChanged += Txt_datePicker_TextChanged;\r\n";
            ___result += "\r\n";
            ___result += "            lbl_dateTo.Font = XFont.Font_10B;\r\n";
            ___result += "            lbl_dateTo.Name = \"lbl_date\";\r\n";
            ___result += "            lbl_dateTo.Text = \"To\";\r\n";
            ___result += "            lbl_dateTo.TextAlign = ContentAlignment.MiddleCenter;\r\n";
            ___result += "            lbl_dateTo.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            ___result += "            lbl_dateTo.Size = new Size(50, 28);\r\n";
            ___result += "            lbl_dateTo.Location = new Point(txt_datePicker.Right + 10, lbl_date.Top);\r\n";
            ___result += "\r\n";
            ___result += "            txt_Todate.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_Todate.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_Todate.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_Todate.Name = \"txt_dateTo\";\r\n";
            ___result += "            txt_Todate.Size = new Size(140, 28);\r\n";
            ___result += "            txt_Todate.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_Todate.Location = new Point(lbl_dateTo.Right - 1, lbl_date.Top);\r\n";
            ___result += "            txt_Todate.TabIndex = 7;\r\n";
            ___result += "\r\n";
            ___result += "            txt_TodatePicker.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_TodatePicker.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_TodatePicker.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_TodatePicker.Name = \"txt_dateTopicker\";\r\n";
            ___result += "            txt_TodatePicker.CustomFormat = \"  dd -MM-yyyy\";\r\n";
            ___result += "            txt_TodatePicker.Format = DateTimePickerFormat.Custom;\r\n";
            ___result += "            txt_TodatePicker.Size = new Size(170, 28);\r\n";
            ___result += "            txt_TodatePicker.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_TodatePicker.Location = new Point(lbl_dateTo.Right - 1, lbl_date.Top);\r\n";
            ___result += "            txt_TodatePicker.TabIndex = 7;\r\n";
            ___result += "            txt_TodatePicker.TextChanged += Txt_TodatePicker_TextChanged;\r\n";
            ___result += "\r\n";
            ___result += "            lbl_party.Font = XFont.Font_10B;\r\n";
            ___result += "            lbl_party.Name = \"lbl_party\";\r\n";
            ___result += "            lbl_party.Text = \"Party\";\r\n";
            ___result += "            lbl_party.TextAlign = ContentAlignment.MiddleCenter;\r\n";
            ___result += "            lbl_party.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            ___result += "            lbl_party.Size = new Size(80, 28);\r\n";
            ___result += "            lbl_party.Location = new Point(txt_TodatePicker.Right + 10, txt_datePicker.Top);\r\n";
            ___result += "\r\n";
            ___result += "            txt_party.Font = XFont.TxtFont;\r\n";
            ___result += "            txt_party.ForeColor = XFontColor.TxtFontColor;\r\n";
            ___result += "            txt_party.BackColor = XTheme.TxtBackcolor;\r\n";
            ___result += "            txt_party.Name = \"txt_party\";\r\n";
            ___result += "            txt_party.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n";
            ___result += "            txt_party.Size = new Size(600, 28);\r\n";
            ___result += "            txt_party.Anchor = XAnchor.LT;\r\n";
            ___result += "            txt_party.Location = new Point(lbl_party.Right - 1, lbl_party.Top);\r\n";
            ___result += "            txt_party.TabIndex = 8;\r\n";
            ___result += "\r\n";
            ___result += "            btn_search.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_search.Location = new Point(txt_party.Right + 10, txt_party.Top);\r\n";
            ___result += "            btn_search.Size = new Size(75, 26);\r\n";
            ___result += "            btn_search.TabIndex = 1;\r\n";
            ___result += "            btn_search.Name = \"btn_search\";\r\n";
            ___result += "            btn_search.Text = \"&Search\";\r\n";
            ___result += "            btn_search.Themes = XTheme.YellowBtn;\r\n";
            ___result += "            btn_search.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_search.Click += Btn_search_Click;\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Search]\r\n";
            ___result += "\r\n";

            #endregion [Search]

            #region [Radio btn]

            ___result += "            #region[Radio btn]\r\n";
            ___result += "\r\n";
            ___result += "            rdo_unrefer.Anchor = XAnchor.TR;\r\n";
            ___result += "            rdo_unrefer.AutoSize = false;\r\n";
            ___result += "            rdo_unrefer.Font = XFont.TxtFont;\r\n";
            ___result += "            rdo_unrefer.Location = new Point(XSize.FPanel_width - 160, 60);\r\n";
            ___result += "            rdo_unrefer.MouseLocation = new Point(-1, -1);\r\n";
            ___result += "            rdo_unrefer.Name = \"rdo_unrefer\";\r\n";
            ___result += "            rdo_unrefer.Size = new Size(200, 30);\r\n";
            ___result += "            rdo_unrefer.TabIndex = 2;\r\n";
            ___result += "            rdo_unrefer.Text = \"UN " + AutoCode.GetCaption(obj.STables.Stables_id, "rdo_unrefer") + "\";\r\n";
            ___result += "            rdo_unrefer.CheckedChanged += new EventHandler(Rdo_unrefer_CheckedChanged);\r\n";
            ___result += "\r\n";
            ___result += "            rdo_refer.Anchor = XAnchor.TR;\r\n";
            ___result += "            rdo_refer.AutoSize = false;\r\n";
            ___result += "            rdo_refer.Font = XFont.TxtFont;\r\n";
            ___result += "            rdo_refer.Location = new Point(rdo_unrefer.Left, rdo_unrefer.Bottom + 20);\r\n";
            ___result += "            rdo_refer.MouseLocation = new Point(-1, -1);\r\n";
            ___result += "            rdo_refer.Name = \"rdo_refer\";\r\n";
            ___result += "            rdo_refer.Size = new Size(200, 30);\r\n";
            ___result += "            rdo_refer.TabIndex = 3;\r\n";
            ___result += "            rdo_refer.Text = \" " + AutoCode.GetCaption(obj.STables.Stables_id, "rdo_refer") + "\";\r\n";
            ___result += "            rdo_refer.CheckedChanged += new EventHandler(Rdo_refer_CheckedChanged);\r\n";
            ___result += "\r\n";
            ___result += "            rdo_showall.Anchor = XAnchor.TR;\r\n";
            ___result += "            rdo_showall.AutoSize = false;\r\n";
            ___result += "            rdo_showall.Font = XFont.TxtFont;\r\n";
            ___result += "            rdo_showall.Location = new Point(rdo_refer.Left, rdo_refer.Bottom + 20);\r\n";
            ___result += "            rdo_showall.MouseLocation = new Point(-1, -1);\r\n";
            ___result += "            rdo_showall.Name = \"rdo_showall\";\r\n";
            ___result += "            rdo_showall.Size = new Size(200, 30);\r\n";
            ___result += "            rdo_showall.TabIndex = 4;\r\n";
            ___result += "            rdo_showall.Text = \" SHOW ALL\";\r\n";
            ___result += "            rdo_showall.CheckedChanged += new EventHandler(Rdo_showall_CheckedChanged);\r\n";
            ___result += "\r\n";
            ___result += "            rdo_notactive.Anchor = XAnchor.TR;\r\n";
            ___result += "            rdo_notactive.AutoSize = false;\r\n";
            ___result += "            rdo_notactive.Font = XFont.TxtFont;\r\n";
            ___result += "            rdo_notactive.Location = new Point(rdo_showall.Left, rdo_showall.Bottom + 20);\r\n";
            ___result += "            rdo_notactive.MouseLocation = new Point(-1, -1);\r\n";
            ___result += "            rdo_notactive.Name = \"rdo_notactive\";\r\n";
            ___result += "            rdo_notactive.Size = new Size(200, 30);\r\n";
            ___result += "            rdo_notactive.TabIndex = 6;\r\n";
            ___result += "            rdo_notactive.Text = \"NOT ACTIVE\";\r\n";
            ___result += "            rdo_notactive.CheckedChanged += new EventHandler(Rdo_notactive_CheckedChanged);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[Radio btn]\r\n";
            ___result += "\r\n";

            #endregion [Radio btn]

            #region [btn Properties]

            ___result += "        #region[btn Properties]\r\n";
            ___result += "\r\n";
            ___result += "            btn_refresh.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_refresh.Location = XLayout.BtnLocation(rdo_notactive.Location);\r\n";
            ___result += "            btn_refresh.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_refresh.TabIndex = 1;\r\n";
            ___result += "            btn_refresh.Name = \"btn_refresh\";\r\n";
            ___result += "            btn_refresh.Text = \"&Refresh\";\r\n";
            ___result += "            btn_refresh.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_refresh.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_refresh.Click += Btn_refresh_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_new.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_new.Location = XLayout.BtnLocation(btn_refresh.Location);\r\n";
            ___result += "            btn_new.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_new.TabIndex = XTab.Index(btn_refresh.TabIndex);\r\n";
            ___result += "            btn_new.Name = \"btn_new\";\r\n";
            ___result += "            btn_new.Text = \"&New\";\r\n";
            ___result += "            btn_new.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_new.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_new.Click += Btn_new_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_edit.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_edit.Location = XLayout.BtnLocation(btn_new.Location);\r\n";
            ___result += "            btn_edit.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_edit.TabIndex = XTab.Index(btn_new.TabIndex);\r\n";
            ___result += "            btn_edit.Name = \"btn_edit\";\r\n";
            ___result += "            btn_edit.Text = \"&Edit\";\r\n";
            ___result += "            btn_edit.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_edit.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_edit.Click += Btn_edit_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_delete.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_delete.Location = XLayout.BtnLocation(btn_edit.Location);\r\n";
            ___result += "            btn_delete.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_delete.TabIndex = XTab.Index(btn_edit.TabIndex);\r\n";
            ___result += "            btn_delete.Name = \"btn_delete\";\r\n";
            ___result += "            btn_delete.Text = \"&Delete\";\r\n";
            ___result += "            btn_delete.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_delete.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_delete.Click += Btn_delete_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_print.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_print.Location = XLayout.BtnLocation(btn_delete.Location);\r\n";
            ___result += "            btn_print.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_print.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n";
            ___result += "            btn_print.Name = \"btn_print\";\r\n";
            ___result += "            btn_print.Text = \"&Print\";\r\n";
            ___result += "            btn_print.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_print.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_print.Click += Btn_print_Click;\r\n";
            ___result += "\r\n";
            //___result += "            btn_quick.Font = XFont.BtnFont;\r\n";
            //___result += "            btn_quick.Location = XLayout.BtnLocation(btn_delete.Location);\r\n";
            //___result += "            btn_quick.Size = XSize.BtnOne;\r\n";
            //___result += "            btn_quick.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n";
            //___result += "            btn_quick.Name = \"btn_quick\";\r\n";
            //___result += "            btn_quick.Text = \"&Quick " + AutoCode.GetCaption(obj.STables.Stables_id, "btn_quick") + "\";\r\n";
            //___result += "            btn_quick.Themes = XTheme.PinkBtn;\r\n";
            //___result += "            btn_quick.Anchor = XAnchor.TR;\r\n";
            //___result += "            btn_quick.Click += Btn_quick_Click;\r\n";
            //___result += "\r\n";
            ___result += "        #endregion[btn Properties]\r\n";
            ___result += "\r\n";

            #endregion [btn Properties]

            #region [Get no Panel]

            //___result += "            #region[Get no Panel]\r\n";
            //___result += "\r\n";
            //___result += "            Getno_panel.Size = new Size(300, 150);\r\n";
            //___result += "            Getno_panel.Location = new Point(btn_print.Left - 250, btn_print.Bottom - 40);\r\n";
            //___result += "            //Getno_panel.BackColor = XTheme.FPanel;\r\n";
            //___result += "            Getno_panel.BackColor = Color.Orange;\r\n";
            //___result += "            Getno_panel.Controls.Add(Getno_innerpanel);\r\n";
            //___result += "            Getno_innerpanel.Controls.Add(txt_getno);\r\n";
            //___result += "            Getno_innerpanel.Controls.Add(lbl_getno);\r\n";
            //___result += "            Getno_innerpanel.Controls.Add(btn_generate);\r\n";
            //___result += "\r\n";
            //___result += "            Getno_innerpanel.Size = new Size(295, 145);\r\n";
            //___result += "            Getno_innerpanel.Location = new Point(2, 2);\r\n";
            //___result += "            Getno_innerpanel.BackColor = Color.White;\r\n";
            //___result += "\r\n";
            //___result += "            lbl_getno.Font = XFont.Font_10B;\r\n";
            //___result += "            lbl_getno.Name = \"lbl_getno\";\r\n";
            //___result += "            lbl_getno.Text = \"No\";\r\n";
            //___result += "            lbl_getno.TextAlign = ContentAlignment.MiddleCenter;\r\n";
            //___result += "            lbl_getno.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            //___result += "            lbl_getno.Size = new Size(150, 28);\r\n";
            //___result += "            lbl_getno.Location = new Point(80, 20);\r\n";
            //___result += "            lbl_getno.BorderStyle = BorderStyle.None;\r\n";
            //___result += "            txt_getno.Font = XFont.TxtFont;\r\n";
            //___result += "            txt_getno.ForeColor = XFontColor.TxtFontColor;\r\n";
            //___result += "            txt_getno.BackColor = XTheme.TxtBackcolor;\r\n";
            //___result += "            txt_getno.Name = \"txt_getno\";\r\n";
            //___result += "            txt_getno.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n";
            //___result += "            txt_getno.Size = new Size(150, 28);\r\n";
            //___result += "            txt_getno.Anchor = XAnchor.LT;\r\n";
            //___result += "            txt_getno.Location = new Point(lbl_getno.Left, lbl_getno.Bottom);\r\n";
            //___result += "\r\n";
            //___result += "            btn_generate.Font = XFont.BtnFont;\r\n";
            //___result += "            btn_generate.Location = new Point(lbl_getno.Left, lbl_getno.Bottom + 40);\r\n";
            //___result += "            btn_generate.Size = new Size(150, 30);\r\n";
            //___result += "            btn_generate.TabIndex = XTab.Index(btn_print.TabIndex);\r\n";
            //___result += "            btn_generate.Name = \"btn_generate\";\r\n";
            //___result += "            btn_generate.Text = \"&Generate\";\r\n";
            //___result += "            btn_generate.Themes = XTheme.RedBtn;\r\n";
            //___result += "            btn_generate.Anchor = XAnchor.TR;\r\n";
            //___result += "            btn_generate.Click += Btn_generate_Click;\r\n";
            //___result += "\r\n";
            //___result += "            #endregion[Get no Panel]\r\n";
            //___result += "\r\n";
            #endregion [Get no Panel]

            #region [List Grid]

            ___result += "        #region[List Grid]\r\n";
            ___result += "\r\n";
            ___result += "            listgrid.AllowUserToAddRows = false;\r\n";
            ___result += "            listgrid.AllowUserToDeleteRows = false;\r\n";
            ___result += "            listgrid.AllowUserToOrderColumns = true;\r\n";
            ___result += "            listgrid.AllowUserToResizeRows = false;\r\n";
            ___result += "            dataGridViewCellStyle1.BackColor = Color.White;\r\n";
            ___result += "            dataGridViewCellStyle1.Font = XFont.Font_10R;\r\n";
            ___result += "            dataGridViewCellStyle1.ForeColor = Color.Black;\r\n";
            ___result += "            dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(255, 255, 204);\r\n";
            ___result += "            dataGridViewCellStyle1.SelectionForeColor = Color.FromArgb(252, 0, 11);\r\n";
            ___result += "            dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True;\r\n";
            ___result += "            listgrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;\r\n";
            ___result += "            listgrid.Anchor = XAnchor.LTRB;\r\n";
            ___result += "            listgrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;\r\n";
            ___result += "            listgrid.BackgroundColor = Color.White;\r\n";
            ___result += "            listgrid.BorderStyle = BorderStyle.Fixed3D;\r\n";
            ___result += "            listgrid.CellBorderStyle = DataGridViewCellBorderStyle.Custom;\r\n";
            ___result += "            listgrid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Custom;\r\n";
            ___result += "            dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            dataGridViewCellStyle2.BackColor = Color.FromArgb(132, 192, 96);\r\n";
            ___result += "            dataGridViewCellStyle2.Font = new Font(\"Microsoft Sans Serif\", 11.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));\r\n";
            ___result += "            dataGridViewCellStyle2.ForeColor = Color.White;\r\n";
            ___result += "            dataGridViewCellStyle2.Padding = new Padding(3);\r\n";
            ___result += "            dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight;\r\n";
            ___result += "            dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText;\r\n";
            ___result += "            dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True;\r\n";
            ___result += "            listgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;\r\n";
            ___result += "            listgrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r\n";
            ___result += "            listgrid.Cursor = Cursors.Default;\r\n";
            ___result += "            dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;\r\n";
            ___result += "            dataGridViewCellStyle3.BackColor = Color.White;\r\n";
            ___result += "            dataGridViewCellStyle3.Font = XFont.Font_10R;\r\n";
            ___result += "            dataGridViewCellStyle3.ForeColor = Color.Black;\r\n";
            ___result += "            dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(255, 255, 204);\r\n";
            ___result += "            dataGridViewCellStyle3.SelectionForeColor = Color.FromArgb(252, 0, 11);\r\n";
            ___result += "            dataGridViewCellStyle3.WrapMode = DataGridViewTriState.False;\r\n";
            ___result += "            listgrid.DefaultCellStyle = dataGridViewCellStyle3;\r\n";
            ___result += "            listgrid.EnableHeadersVisualStyles = false;\r\n";
            ___result += "            listgrid.GridColor = Color.SeaGreen;\r\n";
            ___result += "            listgrid.MultiSelect = false;\r\n";
            ___result += "            listgrid.Name = \"listgrid\";\r\n";
            ___result += "            listgrid.ReadOnly = true;\r\n";
            ___result += "            listgrid.RowHeadersVisible = false;\r\n";
            ___result += "            listgrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;\r\n";
            ___result += "            listgrid.Location = XLayout.ListView;\r\n";
            ___result += "            listgrid.Size = XSize.ListView;\r\n";
            ___result += "            listgrid.StandardTab = true;\r\n";
            ___result += "            listgrid.TabIndex = 0;\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[List Grid]\r\n";
            ___result += "\r\n";

            #endregion [List Grid]

            #region [List]

            ___result += "#region[List]\r\n";
            ___result += "\r\n";
            ___result += "            AutoScaleDimensions = new SizeF(6F, 13F);\r\n";
            ___result += "            AutoScaleMode = AutoScaleMode.Font;\r\n";
            ___result += "            Controls.Add(lpanel);\r\n";
            ___result += "            Name = \"L" + UPPERFIRST + "\";\r\n";
            ___result += "            Size = new Size(1000, 600);\r\n";
            ___result += "            lpanel.ResumeLayout(false);\r\n";
            ___result += "            linner_panel.ResumeLayout(false);\r\n";
            ___result += "            linner_panel.PerformLayout();\r\n";
            ___result += "            ((System.ComponentModel.ISupportInitialize)(listgrid)).EndInit();\r\n";
            ___result += "            ResumeLayout(false);\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "#endregion[List]\r\n";
            ___result += "\r\n";
            #endregion [List]

            #region [Init Grid ]

            ___result += "         #region[Init Grid]\r\n";
            ___result += "\r\n";
            ___result += "         private void InitGrid()\r\n";
            ___result += "         {\r\n";
            ___result += "            listgrid.RowAction += Listgrid_RowAction;\r\n";
            ___result += "\r\n";

            ___result += "            DataGridViewTextBoxColumn col_" + UPPERFIRST + "_Id = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Name = " + CAPITAL + "." + CAPITAL + "_ID;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.HeaderText = \"" + CAPITAL + "_ID \";\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Visible = false;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Width = 100;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_" + UPPERFIRST + "_Id);\r\n";
            ___result += "\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {
                    string field = (list[r].Fieldsname.ToLower()).UpperFirst();

                    ___result += "            DataGridViewTextBoxColumn col_" + field + " = new DataGridViewTextBoxColumn();\r\n";
                    ___result += "            col_" + field + ".Name = " + CAPITAL + "." + list[r].Fieldsname + ";\r\n";
                    ___result += "            col_" + field + ".HeaderText = \"" + list[r].Displayname.Replace("_", " ") + "\";\r\n";
                    ___result += "            //col_" + field + ".Visible = false;\r\n";
                    if (field == "Party_id")
                    {
                        ___result += "            col_" + field + ".Width = 300;\r\n";
                        ___result += "            col_" + field + ".DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;\r\n";
                    }
                    else
                    {
                        ___result += "            col_" + field + ".Width = " + Find.TxtLength_Point(list[r].Displayname) + ";\r\n";
                        ___result += "            col_" + field + ".DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
                    }

                    ___result += "            col_" + field + ".AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
                    ___result += "            listgrid.Columns.Add(col_" + field + ");\r\n";
                    ___result += "\r\n";
                }
            }

            //___result += "            DataGridViewTextBoxColumn col_Notes = new DataGridViewTextBoxColumn();\r\n";
            //___result += "            col_Notes.Name = " + CAPITAL + ".NOTES ;\r\n";
            //___result += "            col_Notes.HeaderText = \"NOTES\";\r\n";
            //___result += "            col_Notes.Visible = false;\r\n";
            //___result += "            col_Notes.Width = 200;\r\n";
            //___result += "            col_Notes.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            //___result += "            col_Notes.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            //___result += "            listgrid.Columns.Add(col_Notes );\r\n";
            //___result += "\r\n";
            //___result += "            DataGridViewTextBoxColumn col_Active_Id = new DataGridViewTextBoxColumn();\r\n";
            //___result += "            col_Active_Id.Name = " + CAPITAL + ".ACTIVE_ID ;\r\n";
            //___result += "            col_Active_Id.HeaderText = \"ACTIVE ID\";\r\n";
            //___result += "            col_Active_Id.Visible = false;\r\n";
            //___result += "            col_Active_Id.Width = 200;\r\n";
            //___result += "            col_Active_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            //___result += "            col_Active_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            //___result += "            listgrid.Columns.Add(col_Active_Id );\r\n";
            //___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn col_grid = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_grid.Name = GRID.CELL;\r\n";
            ___result += "            col_grid.HeaderText = \"STATUS\";\r\n";
            ___result += "            //col_grid.Visible = false;\r\n";
            ___result += "            col_grid.Width = 120;\r\n";
            ___result += "            col_grid.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_grid.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_grid);\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn col_User_Id = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_User_Id.Name = " + CAPITAL + ".USER_ID;\r\n";
            ___result += "            col_User_Id.HeaderText = \"ENTRY BY\";\r\n";
            ___result += "            //col_User_Id.Visible = false;\r\n";
            ___result += "            col_User_Id.Width = 120;\r\n";
            ___result += "            col_User_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_User_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_User_Id);\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn colFiller = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            colFiller.Name = \"FILLER\";\r\n";
            ___result += "            colFiller.HeaderText = \"\";\r\n";
            ___result += "            colFiller.ReadOnly = true;\r\n";
            ___result += "            colFiller.DefaultCellStyle.BackColor = Color.WhiteSmoke;\r\n";
            ___result += "            colFiller.SortMode = DataGridViewColumnSortMode.NotSortable;\r\n";
            ___result += "            colFiller.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;\r\n";
            ___result += "            listgrid.Columns.Add(colFiller);\r\n";
            ___result += "\r\n";
            ___result += "            }\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[Init Grid]\r\n";
            ___result += "\r\n";

            #endregion [Init Grid]

            #region [result]

            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";

            return(___result);

            #endregion [result]
        }
コード例 #9
0
        private static string XCreate(BillTable obj)
        {
            List <SFields>      list  = obj.SFields;
            List <SFieldsItems> Slist = obj.SFieldsItems;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            //string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            //___result += "using CXSETUP; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += "\r\n";
            #endregion [using]

            #region [Table]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class " + UPPERFIRST + "_Tbl\r\n";
            ___result += "    {\r\n";
            ___result += "        #region[Create Table]\r\n";
            ___result += "\r\n";
            ___result += "        public " + UPPERFIRST + "_Tbl (string db)\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = USE.DB(db);\r\n";
            ___result += "\r\n";
            ___result += "            q += CREATE.TABLE(" + CAPITAL + "." + CAPITAL + "_TBL);\r\n";
            ___result += "            q += AddFields.Primary(" + CAPITAL + "." + CAPITAL + "_ID);\r\n";

            ___result += "            q += AddFields.Unique_500(" + CAPITAL + ".UNIQUENO);\r\n";
            ___result += "            q += AddFields.Foreign(" + CAPITAL + "." + CAPITAL + "_TBL, " + CAPITAL + ".COMPANY_ID);\r\n";
            ___result += "            q += AddFields.Foreign(" + CAPITAL + "." + CAPITAL + "_TBL, " + CAPITAL + ".ACY_ID);\r\n";


            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)

                {
                case DATATYPES.VARCHAR_500:
                    ___result += "            q += AddFields.VARCHAR_500(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_300:
                    ___result += "            q += AddFields.VARCHAR_300(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_200:
                    ___result += "            q += AddFields.VARCHAR_200(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_100:
                    ___result += "            q += AddFields.VARCHAR_100(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.UNIQUE_500:
                    ___result += "            q += AddFields.Unique_500(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.INT:
                    ___result += "            q += AddFields.Int(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FORIEGN:
                    ___result += "            q += AddFields.Foreign(" + CAPITAL + "." + CAPITAL + "_TBL, " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;


                case DATATYPES.DATE:
                    ___result += "            q += AddFields.Date(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DATETIME:
                    ___result += "            q += AddFields.DateTime(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.ENUM_Y_N:
                    ___result += "            q += AddFields.Enum_y_n(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.SMALLINT:
                    ___result += "            q += AddFields.Smallint(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.BOOLX:
                    ___result += "            q += AddFields.BoolX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "            q += AddFields.FalseX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "            q += AddFields.TrueX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "            q += AddFields.Decimal_3(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "            q += AddFields.Decimal_2(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "            q += AddFields.Double(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.LONGTEXT:
                    ___result += "            q += AddFields.Longtext(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;
                }
            }
            ___result += "            q += AddFields.Notes;\r\n";
            ___result += "            q += AddFields.Active;\r\n";
            ___result += "            q += AddFields.User_id(" + CAPITAL + "." + CAPITAL + "_TBL);\r\n";
            ___result += "            q += AddFields.EOF;\r\n";
            ___result += "\r\n";
            ___result += "            new " + xDAL + "().Execute(q);\r\n";
            ___result += "\r\n";
            ___result += "            " + UPPERFIRST + "Items_Tbl(db);\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Table]\r\n";
            ___result += "\r\n";

            #endregion [Table]

            #region [Table items]

            ___result += "        #region[Table Items]\r\n";
            ___result += "\r\n";
            ___result += "        public static void " + UPPERFIRST + "Items_Tbl(string db)\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = USE.DB(db);\r\n";
            ___result += "\r\n";
            ___result += "            q += CREATE.TABLE(" + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL);\r\n";
            ___result += "            q += AddFields.Primary(" + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID);\r\n";

            for (int r = 0; r < Slist.Count; r++)
            {
                switch (Slist[r].Datatype)

                {
                case DATATYPES.VARCHAR_500:
                    ___result += "            q += AddFields.VARCHAR_500(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_300:
                    ___result += "            q += AddFields.VARCHAR_300(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_200:
                    ___result += "            q += AddFields.VARCHAR_200(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_100:
                    ___result += "            q += AddFields.VARCHAR_100(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.UNIQUE_500:
                    ___result += "            q += AddFields.Unique_500(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.INT:
                    ___result += "            q += AddFields.Int(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FORIEGN:
                    ___result += "            q += AddFields.Foreign(" + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL, " + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;


                case DATATYPES.DATE:
                    ___result += "            q += AddFields.Date(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DATETIME:
                    ___result += "            q += AddFields.DateTime(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.ENUM_Y_N:
                    ___result += "            q += AddFields.Enum_y_n(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.SMALLINT:
                    ___result += "            q += AddFields.Smallint(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.BOOLX:
                    ___result += "            q += AddFields.BoolX(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "            q += AddFields.FalseX(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "            q += AddFields.TrueX(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "            q += AddFields.Decimal_3(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "            q += AddFields.Decimal_2(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "            q += AddFields.Double(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.LONGTEXT:
                    ___result += "            q += AddFields.Longtext(" + CAPITAL + "ITEMS." + Slist[r].Fieldsname.ToUpper() + "); \r\n";
                    break;
                }
            }
            ___result += "            q += AddFields.EOF;\r\n";
            ___result += "\r\n";
            ___result += "            new " + xDAL + "().Execute(q);\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Table Items]\r\n";
            ___result += "\r\n";

            #endregion [Tables Items]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #10
0
ファイル: MasterUpdate.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System; \r\n";
            ___result += "using System.Data; \r\n";
            ___result += "using CXLIB; \r\n";
            //___result += "using CXCORE; \r\n";

            ___result += "\r\n";
            #endregion [using]

            #region [Update]

            ___result += "namespace CXCORE\r\n";
            ___result += "{\r\n";
            ___result += "    public static class U_" + UPPERFIRST + "\r\n";
            ___result += "    {\r\n";
            ___result += "        #region[]\r\n";
            ___result += "\r\n";
            ___result += "            public static void GetUpdated(string OldDB, string newDB)\r\n";
            ___result += "            {\r\n";
            ___result += "\r\n";
            ___result += "                string tablename = " + CAPITAL + "." + CAPITAL + "_TBL;\r\n";
            ___result += "\r\n";
            ___result += "                int count = GetCount(tablename, OldDB);\r\n";
            ___result += "\r\n";
            ___result += "                for (int i = 1; i <= count; i++)\r\n";
            ___result += "                {\r\n";
            ___result += "                    var obj = GetOldData(i, OldDB);\r\n";
            ___result += "\r\n";
            ___result += "                if (obj != null)\r\n";
            ___result += "                {\r\n";
            ___result += "                    InsertData(obj, newDB);\r\n";
            ___result += "                }\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[]\r\n";
            ___result += "\r\n";
            ___result += "        #region[Get Count]\r\n";
            ___result += "\r\n";
            ___result += "            private static int GetCount(string tablename, string OldDB)\r\n";
            ___result += "            {\r\n";
            ___result += "                string ID = (tablename.Remove((tablename).Length - 4).ToUpper()) + \"_ID\";\r\n";
            ___result += "\r\n";
            ___result += "                string q = \"USE \" + OldDB + \"; \";\r\n";
            ___result += "                q += \"SELECT * FROM \" + tablename + \" ORDER BY \" + ID + \" DESC LIMIT 1 ; \";\r\n";
            ___result += "\r\n";
            ___result += "                using (IDataReader redr = new DAL().Listreader(q))\r\n";
            ___result += "                {\r\n";
            ___result += "                    while (redr.Read() == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        int lastId = Convert.ToInt32(redr[ID]);\r\n";
            ___result += "\r\n";
            ___result += "                        return lastId;\r\n";
            ___result += "                    }\r\n";
            ___result += "                    return 0;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Get Count]\r\n";
            ___result += "\r\n";
            ___result += "        #region[Get Old data]\r\n";
            ___result += "\r\n";
            ___result += "            private static " + UPPERFIRST + " GetOldData(int id, string OldDB)\r\n";
            ___result += "            {\r\n";
            ___result += "                string q = \"USE \" + OldDB + \"; \";\r\n";
            ___result += "                q += \"SELECT * FROM \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + id + \"'; \";\r\n";
            ___result += "\r\n";
            ___result += "                using (IDataReader redr = new DAL().Listreader(q))\r\n";
            ___result += "                {\r\n";
            ___result += "                    while (redr.Read() == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        " + UPPERFIRST + " obj = new " + UPPERFIRST + "\r\n";
            ___result += "                        {\r\n";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.INT:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Integer(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;

                default:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                    break;
                }
            }
            ___result += "                        Notes = redr[" + CAPITAL + ".NOTES].ToString(),\r\n";
            ___result += "                        Active_id = redr[" + CAPITAL + ".ACTIVE_ID].ToString(),\r\n";
            ___result += "                        User_id = \"1\"\r\n";

            ___result += "                        };\r\n";
            ___result += "\r\n";
            ___result += "                        return obj;\r\n";
            ___result += "                    }\r\n";
            ___result += "                    return null;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Get Old data]\r\n";
            ___result += "\r\n";

            ___result += "#region[Check data]\r\n";
            ___result += "\r\n";
            ___result += "            private static bool CheckData(" + UPPERFIRST + " obj, string newDB)\r\n";
            ___result += "            {\r\n";
            ___result += "                string q = \"USE \" + newDB + \"; \";\r\n";
            ___result += "                q += \"SELECT * FROM \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_NAME + \" = '\" + obj." + UPPERFIRST + "_name + \"'; \";\r\n";
            ___result += "\r\n";
            ___result += "                using (IDataReader redr = new DAL().Listreader(q))\r\n";
            ___result += "                {\r\n";
            ___result += "                    while (redr.Read() == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        obj." + UPPERFIRST + "_id = redr[" + CAPITAL + "." + CAPITAL + "_ID].ToString();\r\n";
            ___result += "\r\n";
            ___result += "                        C" + UPPERFIRST + ".Update(obj, new DAL());\r\n";
            ___result += "\r\n";
            ___result += "                        return true;\r\n";
            ___result += "                    }\r\n";
            ___result += "                    return false;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "            #endregion[Check data]\r\n";
            ___result += "\r\n";
            ___result += "        #region[Insert data]\r\n";
            ___result += "\r\n";
            ___result += "            private static void InsertData(" + UPPERFIRST + " obj, string newDB)\r\n";
            ___result += "            {\r\n";
            ___result += "                if (CheckData(obj, newDB) == false)\r\n";
            ___result += "                {\r\n";
            ___result += "                    C" + UPPERFIRST + ".Insert(obj, new DAL());\r\n";
            ___result += "                };\r\n";
            ___result += "\r\n";
            ___result += "            }\r\n";
            ___result += "        #endregion[Insert data]\r\n";
            ___result += "\r\n";

            #endregion [Default Values]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #11
0
ファイル: LVersion.cs プロジェクト: CODEXSUN/codexdotnet
 void txt_version_LookupUpdate(object sender, EventArgs e)
 {
     txt_version_name.LookupList = CVersion_exten.GetforLookup();
 }
コード例 #12
0
ファイル: SConstItems.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List <SFieldsItems> list = obj.SFieldsItems;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = ChangeCase.ToUpper(TRIM_TBL);
            string SMALL      = ChangeCase.ToLower(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);

            string ___result = "";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";
            #endregion [Conclusion]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";

            #endregion [namespace]

            #region [string Properties]

            ___result += "    #region[Properties]\r\n";
            ___result += "\r\n";
            ___result += "    public class " + UPPERFIRST + "items\r\n";
            ___result += "    {\r\n";
            ___result += "        public string " + UPPERFIRST + "items_id { get; set; }\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)

                {
                //case DATATYPES.VARCHAR_500:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_300:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_200:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_100:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.UNIQUE_500:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.INT:
                //    ___result += "        public int " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.FORIEGN:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;


                //case DATATYPES.DATE:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.DATETIME:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.ENUM_Y_N:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;
                //case DATATYPES.SMALLINT:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                case DATATYPES.BOOLX:
                    ___result += "        public bool " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "        public bool " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "        public bool " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "        public decimal " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "        public decimal " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "        public double " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;


                default:
                    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                    break;
                }
            }
            ___result += "    }\r\n";
            ___result += "\r\n";
            ___result += "    #endregion[Properties]\r\n";
            ___result += "\r\n";

            #endregion [string Properties]

            #region [string Const class]

            ___result += "    #region[string Const class]\r\n";
            ___result += "\r\n";
            ___result += "    public static class " + CAPITAL + "ITEMS\r\n";
            ___result += "    {\r\n";
            ___result += "        public const string " + CAPITAL + "ITEMS_ID = \"" + CAPITAL + "ITEMS_ID\";\r\n";


            for (int r = 0; r < list.Count; r++)
            {
                ___result += "        public const string " + list[r].Fieldsname.ToUpper() + " = \"" + list[r].Fieldsname.ToUpper() + "\";\r\n";
            }

            ___result += "\r\n";
            ___result += "        public const string " + CAPITAL + "ITEMS_TBL = \"" + CAPITAL + "ITEMS_TBL\";\r\n";
            ___result += "    }\r\n";
            ___result += "\r\n";
            ___result += "    #endregion[string Const class]\r\n";
            ___result += "\r\n";
            ___result += "}//ns\r\n";

            #endregion [string Const class]

            #region [result]

            return(___result);
        }
コード例 #13
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System; \r\n ";
            ___result += "using Microsoft.VisualStudio.TestTools.UnitTesting; \r\n ";
            ___result += "using System.Collections.Generic; \r\n ";
            ___result += "using System.Data; \r\n ";
            ___result += "using CXCORE; \r\n ";
            ___result += "using CXLIB; \r\n ";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace CXTEST\r\n";
            ___result += "{\r\n";
            ___result += "    [TestClass] \r\n ";
            ___result += "    public class Test" + UPPERFIRST + " \r\n ";
            ___result += "    { \r\n ";
            // ___result += "        [TestInitialize] \r\n ";
            //___result += "        public void " + UPPERFIRST + "Intilize() \r\n ";
            // ___result += "        { \r\n ";
            //___result += "            CodexsunSetup." + UPPERFIRST + "Tbl.CleanTbl(Server.DBNAME); \r\n ";
            //___result += "        } \r\n ";
            ___result += " \r\n ";
            ___result += "        [TestMethod] \r\n ";
            ___result += "        public void " + UPPERFIRST + "Test() \r\n ";
            ___result += "        { \r\n ";
            ___result += " \r\n ";

            #endregion [namespace]

            #region [Insert]

            ___result += "            #region[Insert] \r\n ";
            ___result += " \r\n ";
            ___result += "            " + UPPERFIRST + " obj = new " + UPPERFIRST + "() \r\n ";
            ___result += "            { \r\n ";
            ___result += "                " + UPPERFIRST + "_id = \"\", \r\n ";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"1\", \r\n ";
                }
                else
                {
                    switch (list[r].Datatype)
                    {
                    case DATATYPES.VARCHAR_100:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"" + list[r].Fieldsname + "_insert\", \r\n ";
                        break;

                    case DATATYPES.DATE:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDate(Current.Date) + "\", \r\n ";
                        break;

                    case DATATYPES.DATETIME:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDateTime(Current.Datetime) + "\", \r\n ";
                        break;

                    case DATATYPES.BOOLX:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"True\", \r\n ";
                        break;

                    case DATATYPES.DECMIAL_2:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"1.03\", \r\n ";
                        break;

                    case DATATYPES.INT:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"9\", \r\n ";
                        break;

                    case DATATYPES.SMALLINT:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"1\", \r\n ";
                        break;

                    default:
                        ___result += "                " + list[r].Fieldsname.UpperFirst() + " = \"00\", \r\n ";
                        break;
                    }
                }
            }

            ___result += "                Notes = Core.EmptyNotes, \r\n ";
            ___result += "                Active_id = Core.Active, \r\n ";
            ___result += "                User_id = Current.Codexsun \r\n ";
            ___result += "            }; \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Insert(obj, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            #endregion[Insert] \r\n ";
            ___result += " \r\n ";

            #endregion [Insert]

            #region [search names & pkid]

            ___result += "            #region[search names & pkid] \r\n ";
            ___result += " \r\n ";
            ___result += "            " + UPPERFIRST + " obj1 = C" + UPPERFIRST + "_exten.SearchName(obj." + UPPERFIRST + "_name, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            " + UPPERFIRST + " obj2 = C" + UPPERFIRST + "_exten.PKId(obj1." + UPPERFIRST + "_id, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";


            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            Assert.AreEqual(C" + list[r].Fieldsname.UpperFirst().Replace("_id", "") + "_exten.GetName_Id(obj." + list[r].Fieldsname.UpperFirst() + ") , obj2." + list[r].Fieldsname.UpperFirst() + "); \r\n ";
                }
                else
                {
                    ___result += "            Assert.AreEqual(obj." + list[r].Fieldsname.UpperFirst() + ", obj2." + list[r].Fieldsname.UpperFirst() + "); \r\n ";
                }
            }
            ___result += "            Assert.AreEqual(obj.Notes, obj2.Notes); \r\n ";
            ___result += "            Assert.AreEqual(obj.Active_id, obj2.Active_id); \r\n ";
            ___result += "            Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); \r\n ";
            ___result += " \r\n ";
            ___result += " \r\n ";
            ___result += "            #endregion[search names & pkid] \r\n ";
            ___result += " \r\n ";

            #endregion [search names & pkid]

            #region [Update]

            ___result += "            #region[Update] \r\n ";
            ___result += " \r\n ";
            ___result += "            obj." + UPPERFIRST + "_id = obj2." + UPPERFIRST + "_id; \r\n ";


            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                }
                else
                {
                    switch (list[r].Datatype)
                    {
                    case DATATYPES.VARCHAR_100:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + list[r].Fieldsname.UpperFirst() + "_update\"; \r\n ";
                        break;

                    case DATATYPES.DATE:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDate(Current.Date) + "\"; \r\n ";
                        break;

                    case DATATYPES.DATETIME:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDateTime(Current.Datetime) + "\"; \r\n ";
                        break;

                    case DATATYPES.BOOLX:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"True\"; \r\n ";
                        break;

                    case DATATYPES.DECMIAL_2:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"1.23\"; \r\n ";
                        break;

                    case DATATYPES.INT:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"9\"; \r\n ";
                        break;

                    case DATATYPES.SMALLINT:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                        break;

                    default:
                        ___result += "                obj." + list[r].Fieldsname.UpperFirst() + " = \"00\"; \r\n ";
                        break;
                    }
                }
            }

            ___result += "            obj.Notes = \"test notes\"; \r\n ";
            ___result += "            obj.Active_id = Core.NotActive; \r\n ";
            ___result += "            obj.User_id = Current.Codexsun; \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Update(obj, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            obj1 = C" + UPPERFIRST + "_exten.SearchName(obj." + UPPERFIRST + "_name, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            obj2 = C" + UPPERFIRST + "_exten.PKId(obj1." + UPPERFIRST + "_id, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            Assert.AreEqual(obj." + UPPERFIRST + "_id, obj2." + UPPERFIRST + "_id); \r\n ";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            Assert.AreEqual(C" + list[r].Fieldsname.UpperFirst().Replace("_id", "") + "_exten.GetName_Id(obj." + list[r].Fieldsname.UpperFirst() + ") , obj2." + list[r].Fieldsname.UpperFirst() + "); \r\n ";
                }
                else
                {
                    ___result += "            Assert.AreEqual(obj." + list[r].Fieldsname.UpperFirst() + ", obj2." + list[r].Fieldsname.UpperFirst() + "); \r\n ";
                }
            }

            ___result += "            Assert.AreEqual(obj.Notes, obj2.Notes); \r\n ";
            ___result += "            Assert.AreEqual(obj.Active_id, obj2.Active_id); \r\n ";
            ___result += "            Assert.AreEqual(CUser_exten.GetName_Id(obj.User_id), obj2.User_id); \r\n ";
            ___result += " \r\n ";

            #endregion [Update]

            #region [delete]

            ___result += "            #endregion[Update] \r\n ";
            ___result += " \r\n ";
            ___result += "            #region[delete] \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Delete(obj." + UPPERFIRST + "_id, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            obj2 = C" + UPPERFIRST + "_exten.PKId(obj1." + UPPERFIRST + "_id, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            Assert.AreEqual(null, obj2." + UPPERFIRST + "_id); \r\n ";
            ___result += " \r\n ";
            ___result += "            #endregion[delete] \r\n ";
            ___result += " \r\n ";

            #endregion [delete

            #region [active]

            ___result += "            #region[active] \r\n ";
            ___result += " \r\n ";
            ___result += "            obj = new " + UPPERFIRST + "() \r\n ";
            ___result += "            { \r\n ";
            ___result += "            " + UPPERFIRST + "_id = \"\", \r\n ";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"1\", \r\n ";
                }
                else
                {
                    switch (list[r].Datatype)
                    {
                    case DATATYPES.VARCHAR_100:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"" + list[r].Fieldsname + "_active\", \r\n ";
                        break;

                    case DATATYPES.DATE:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDate(Current.Date) + "\", \r\n ";
                        break;

                    case DATATYPES.DATETIME:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDateTime(Current.Datetime) + "\", \r\n ";
                        break;

                    case DATATYPES.BOOLX:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"True\", \r\n ";
                        break;

                    case DATATYPES.DECMIAL_2:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"1.23\", \r\n ";
                        break;

                    case DATATYPES.INT:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"9\", \r\n ";
                        break;

                    case DATATYPES.SMALLINT:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"1\", \r\n ";
                        break;

                    default:
                        ___result += "            " + list[r].Fieldsname.UpperFirst() + " = \"00\", \r\n ";
                        break;
                    }
                }
            }

            ___result += "            Notes = Core.EmptyNotes, \r\n ";
            ___result += "            Active_id = Core.Active, \r\n ";
            ___result += "            User_id = Current.Codexsun \r\n ";
            ___result += "            }; \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Insert(obj, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            obj1 = C" + UPPERFIRST + "_exten.SearchName(obj." + UPPERFIRST + "_name, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            obj2 = C" + UPPERFIRST + "_exten.PKId(obj1." + UPPERFIRST + "_id, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";


            ___result += "            List<" + UPPERFIRST + "> list = C" + UPPERFIRST + "_exten.Active(new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "\r\n ";
            ___result += "            if (list.Count != 0)\r\n ";
            ___result += "            {\r\n ";
            ___result += "                for (int i = 0; i < list.Count; i++)\r\n ";
            ___result += "                {\r\n ";
            ___result += "                    Assert.AreEqual(Core.Active, list[i].Active_id); \r\n ";
            ___result += "                }\r\n ";
            ___result += "            }\r\n ";
            ___result += " \r\n ";
            ___result += "            #endregion[Active] \r\n ";
            ___result += " \r\n ";

            #endregion [Active]

            #region [Not Active]

            ___result += "            #region[Not Active] \r\n ";
            ___result += " \r\n ";
            ___result += "            obj." + UPPERFIRST + "_id = obj1." + UPPERFIRST + "_id; \r\n ";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                }
                else
                {
                    switch (list[r].Datatype)
                    {
                    case DATATYPES.VARCHAR_100:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + list[r].Fieldsname + "_notactive\"; \r\n ";
                        break;

                    case DATATYPES.DATE:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDate(Current.Date) + "\"; \r\n ";
                        break;

                    case DATATYPES.DATETIME:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDateTime(Current.Datetime) + "\"; \r\n ";
                        break;

                    case DATATYPES.BOOLX:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"True\"; \r\n ";
                        break;

                    case DATATYPES.DECMIAL_2:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1.23\"; \r\n ";
                        break;

                    case DATATYPES.INT:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"9\"; \r\n ";
                        break;

                    case DATATYPES.SMALLINT:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                        break;

                    default:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"00\"; \r\n ";
                        break;
                    }
                }
            }
            ___result += "            obj.Notes = \"test notes\"; \r\n ";
            ___result += "            obj.Active_id = Core.NotActive; \r\n ";
            ___result += "            obj.User_id = Current.Codexsun; \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Update(obj, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            list = C" + UPPERFIRST + "_exten.NotActive(new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            //___result += "            Assert.AreEqual(obj." + UPPERFIRST + "_id, list[0]." + UPPERFIRST + "_id); \r\n ";
            ___result += "\r\n ";
            ___result += "            if (list.Count != 0)\r\n ";
            ___result += "            {\r\n ";
            ___result += "                for (int i = 0; i < list.Count; i++)\r\n ";
            ___result += "                {\r\n ";
            ___result += "                    Assert.AreEqual(Core.NotActive, list[i].Active_id); \r\n ";
            ___result += "                }\r\n ";
            ___result += "            }\r\n ";
            ___result += "\r\n ";
            ___result += "            #endregion[Not Active] \r\n ";
            ___result += " \r\n ";

            #endregion [Not Active]

            #region [Lookup]

            ___result += "            #region[Lookup] \r\n ";
            ___result += " \r\n ";
            ___result += "            obj." + UPPERFIRST + "_id = obj1." + UPPERFIRST + "_id; \r\n ";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == AutoCode.FOREIGNKEY)
                {
                    ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                }
                else
                {
                    switch (list[r].Datatype)
                    {
                    case DATATYPES.VARCHAR_100:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + list[r].Fieldsname + "_lookup\"; \r\n ";
                        break;

                    case DATATYPES.DATE:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDate(Current.Date) + "\"; \r\n ";
                        break;

                    case DATATYPES.DATETIME:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"" + ConvertTO.SqlDateTime(Current.Datetime) + "\"; \r\n ";
                        break;

                    case DATATYPES.BOOLX:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"True\"; \r\n ";
                        break;

                    case DATATYPES.DECMIAL_2:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1.25\"; \r\n ";
                        break;

                    case DATATYPES.INT:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"9\"; \r\n ";
                        break;

                    case DATATYPES.SMALLINT:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"1\"; \r\n ";
                        break;

                    default:
                        ___result += "            obj." + list[r].Fieldsname.UpperFirst() + " = \"00\"; \r\n ";
                        break;
                    }
                }
            }

            ___result += "            obj.Notes = \"test notes\"; \r\n ";
            ___result += "            obj.Active_id = Core.Active; \r\n ";
            ___result += "            obj.User_id = Current.Codexsun; \r\n ";
            ___result += " \r\n ";
            ___result += "            C" + UPPERFIRST + ".Update(obj, new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "            DataTable tbl = C" + UPPERFIRST + "_exten.GetforLookup(new " + xDAL + "()); \r\n ";
            ___result += " \r\n ";
            ___result += "\r\n ";
            ___result += "            if (list.Count != 0)\r\n ";
            ___result += "            {\r\n ";
            ___result += "                for (int i = 0; i < list.Count; i++)\r\n ";
            ___result += "                {\r\n ";
            ___result += "                    Assert.AreEqual(Core.Active, (tbl.Rows[i][COUNTRY.ACTIVE_ID]) + \"\"); \r\n ";
            ___result += "                }\r\n ";
            ___result += "            }\r\n ";
            ___result += "\r\n ";
            ___result += "            #endregion[Lookup] \r\n ";
            ___result += " \r\n ";
            #endregion [Lookup]

            #region [Get id name]
            ___result += "            #region[Get id name] \r\n ";
            ___result += "\r\n ";
            ___result += "            Assert.AreEqual(C" + UPPERFIRST + "_exten.GetId_Name(obj." + UPPERFIRST + "_name), obj." + UPPERFIRST + "_id + \"\"); \r\n ";
            ___result += "            Assert.AreEqual(C" + UPPERFIRST + "_exten.GetName_Id(obj." + UPPERFIRST + "_id), obj." + UPPERFIRST + "_name + \"\"); \r\n ";
            ___result += "\r\n ";
            ___result += "            C" + UPPERFIRST + ".Delete(obj." + UPPERFIRST + "_id, new DAL());\r\n ";
            ___result += "\r\n ";
            ___result += "            #endregion[Get id name] \r\n ";

            #endregion

            #region [result]
            ___result += "        } \r\n ";
            ___result += "\r\n ";
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #14
0
        private static string XCreate(BillTable obj)
        {
            List <SFieldsItems> list = obj.SFieldsItems;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System.Data;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using CXCORE;\r\n";
            ___result += "using System.Collections.Generic;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public static class C" + UPPERFIRST + "items_exten\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Entity List]
            ___result += "         #region[Entity List] \r\n";
            ___result += "  \r\n";
            ___result += "         private static List<" + UPPERFIRST + "items> EntityList(string q) \r\n";
            ___result += "         { \r\n";
            ___result += "             List<" + UPPERFIRST + "items> list = new List<" + UPPERFIRST + "items>(); \r\n";
            ___result += "  \r\n";
            ___result += "             using (IDataReader redr = new " + xDAL + "().Listreader(q)) \r\n";
            ___result += "             { \r\n";
            ___result += "                 while (redr.Read() == true) \r\n";
            ___result += "                 { \r\n";
            ___result += "                      " + UPPERFIRST + "items  obj = new  " + UPPERFIRST + "items () \r\n";
            ___result += "                     { \r\n";
            ___result += "                        " + UPPERFIRST + "items_id = redr[" + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID].ToString(), \r\n";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.UpperFirst() == UPPERFIRST + "_id")
                    {
                        ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                    }
                    else
                    {
                        ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NO") + "].ToString(),\r\n";
                    }
                }
                else
                {
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                }
            }

            ___result += "                     }; \r\n";
            ___result += "  \r\n";
            ___result += "                     list.Add(obj); \r\n";
            ___result += "                 } \r\n";
            ___result += "  \r\n";
            ___result += "             } \r\n";
            ___result += "             return list; \r\n";
            ___result += "         } \r\n";
            ___result += "  \r\n";
            ___result += "         #endregion[Entity List] \r\n";
            ___result += "  \r\n";

            #endregion [Entity List]

            #region [FKId]

            ___result += "         #region[FKId] \r\n";
            ___result += "  \r\n";
            ___result += "         public static List<" + UPPERFIRST + "items> FKId(string id ) \r\n";
            ___result += "         { \r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL +\".* \\r\\n\"; \r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if ((list[r].Fieldsname.ToUpper()) == CAPITAL + "_ID")
                    {
                        ___result += "            q += \", \"+ " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL");
                        ___result += " + \".\"+ " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NO") + " + \" \\r\\n\"; \r\n";
                    }
                    else
                    {
                        ___result += "            q += \", \"+ " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL");
                        ___result += " + \".\"+ " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NO") + " + \" \\r\\n\"; \r\n";
                    }
                }
            }

            ___result += "            q += \" FROM  \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \" \\r\\n\"; \r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";  \r\n";
                    ___result += "            q += \" ON(\" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \".\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + "+\" )\\r\\n\";  \r\n";
                }
            }
            ___result += "            q += \" WHERE \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \"  = '\" + id + \"' \\r\\n\"; \r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \".\" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID + \";\\r\\n\"; \r\n";
            ___result += "  \r\n";
            ___result += "             return EntityList(q); \r\n";
            ___result += "         } \r\n";
            ___result += "  \r\n";
            ___result += "         #endregion[FKId] \r\n";
            ___result += "  \r\n";

            #endregion [FKId]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #15
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using CXLIB; \r\n";
            ___result += "\r\n";
            #endregion [using]

            #region [Setup]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class " + UPPERFIRST + "_Tbl\r\n";
            ___result += "    {\r\n";
            ___result += "        #region[Create Table]\r\n";
            ___result += "\r\n";
            ___result += "        public " + UPPERFIRST + "_Tbl (string db)\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = USE.DB(db);\r\n";
            ___result += "\r\n";
            ___result += "            q += CREATE.TABLE(" + CAPITAL + "." + CAPITAL + "_TBL);\r\n";
            ___result += "            q += AddFields.Primary(" + CAPITAL + "." + CAPITAL + "_ID);\r\n";


            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)

                {
                case DATATYPES.VARCHAR_500:
                    ___result += "            q += AddFields.VARCHAR_500(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_300:
                    ___result += "            q += AddFields.VARCHAR_300(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_200:
                    ___result += "            q += AddFields.VARCHAR_200(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.VARCHAR_100:
                    ___result += "            q += AddFields.VARCHAR_100(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.UNIQUE_500:
                    ___result += "            q += AddFields.Unique_500(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.INT:
                    ___result += "            q += AddFields.Int(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FORIEGN:
                    ___result += "            q += AddFields.Foreign(" + CAPITAL + "." + CAPITAL + "_TBL, " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;


                case DATATYPES.DATE:
                    ___result += "            q += AddFields.Date(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DATETIME:
                    ___result += "            q += AddFields.DateTime(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.ENUM_Y_N:
                    ___result += "            q += AddFields.Enum_y_n(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.SMALLINT:
                    ___result += "            q += AddFields.Smallint(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.BOOLX:
                    ___result += "            q += AddFields.BoolX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "            q += AddFields.FalseX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "            q += AddFields.TrueX(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "            q += AddFields.Decimal_3(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "            q += AddFields.Decimal_2(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "            q += AddFields.Double(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;

                case DATATYPES.LONGTEXT:
                    ___result += "            q += AddFields.Longtext(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "); \r\n";
                    break;
                }
            }
            ___result += "            q += AddFields.Notes;\r\n";
            ___result += "            q += AddFields.Active;\r\n";
            ___result += "            q += AddFields.User_id(" + CAPITAL + "." + CAPITAL + "_TBL);\r\n";
            ___result += "            q += AddFields.EOF;\r\n";
            ___result += "\r\n";
            ___result += "            new " + xDAL + "().Execute(q);\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Create Table]\r\n";
            ___result += "\r\n";

            #endregion [Setup]

            #region [Default Values]

            ___result += "        #region[Default Values]\r\n";
            ___result += "\r\n";
            ___result += "        public static void InsertDefault_" + UPPERFIRST + "(string db)\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = USE.DB(db);\r\n";
            ___result += "\r\n";


            ___result += "            q += DB.INSERT(" + CAPITAL + "." + CAPITAL + "_TBL);\r\n";

            ___result += "            q += DB.FIELD_1ST(" + CAPITAL + "." + CAPITAL + "_ID);\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "            q += DB.FIELD(" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + ");\r\n";
            }
            ___result += "            q += DB.NOTES;\r\n";
            ___result += "            q += DB.ACTIVE_ID;\r\n";
            ___result += "            q += DB.USER_ID;\r\n";
            ___result += "            q += DB.MID;\r\n";
            ___result += "            q += DB.VALUE_1ST(\"1\");\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)

                {
                case DATATYPES.VARCHAR_500:
                    ___result += "            q += DB.VALUE(\"-\");\r\n";
                    break;

                case DATATYPES.VARCHAR_300:
                    ___result += "            q += DB.VALUE(\"-\");\r\n";
                    break;

                case DATATYPES.VARCHAR_200:
                    ___result += "            q += DB.VALUE(\"-\");\r\n";
                    break;

                case DATATYPES.VARCHAR_100:
                    ___result += "            q += DB.VALUE(\"-\");\r\n";
                    break;

                case DATATYPES.UNIQUE_500:
                    ___result += "            q += DB.VALUE(\"-\");\r\n";
                    break;

                case DATATYPES.INT:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.FORIEGN:
                    ___result += "            q += DB.VALUE(\"1\");\r\n";
                    break;


                case DATATYPES.DATE:
                    ___result += "            q += DB.VALUE(\"" + ConvertTO.SqlDate(Core.Date_Now) + "\");\r\n";
                    break;

                case DATATYPES.DATETIME:
                    ___result += "            q += DB.VALUE(\"" + ConvertTO.SqlDateTime(DateTime.Now.ToString()) + "\");\r\n";
                    break;

                case DATATYPES.ENUM_Y_N:
                    ___result += "            q += DB.VALUE(\"N\");\r\n";
                    break;

                case DATATYPES.SMALLINT:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.BOOLX:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "            q += DB.VALUE(\"False\");\r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "            q += DB.VALUE(\"True\");\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "            q += DB.VALUE(\"0\");\r\n";
                    break;

                case DATATYPES.LONGTEXT:
                    ___result += "            q += DB.VALUE(\"---\");\r\n";
                    break;
                }
            }
            ___result += "            q += DB.NotesValue;\r\n";
            ___result += "            q += DB.ActiveValue;\r\n";
            ___result += "            q += DB.UserValue;\r\n";
            ___result += "            q += DB.EOF;\r\n";
            ___result += "\r\n";
            ___result += "            new DAL().Execute(q);\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Default Values]\r\n";
            ___result += "\r\n";

            #endregion [Default Values]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #16
0
ファイル: MVForm.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(MasterDetails obj)
        {
            List<MasterTablesItems> list = obj.Mastertablesitems;
            //List<SFieldsItems> sub = obj.MFieldsItems;


            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region[using]

            ___result += "using System; \r\n";
            //___result += "using System.ComponentModel; \r\n";
            //___result += "using System.Collections.Generic; \r\n";
            //___result += "using System.Drawing; \r\n";
            ___result += "using System.Windows.Forms; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += " \r\n";

            #endregion[using]

            #region[namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class F" + UPPERFIRST + "\r\n";
            ___result += "    { \r\n";

            #endregion[namespace]

            #region[Action]

            ___result += "        #region[Action]\r\n";
            ___result += "\r\n";
            ___result += "        private BtnEvent fAction = BtnEvent.Open;\r\n";
            ___result += "        private " + UPPERFIRST + " obj;\r\n";
            ___result += "        private string vId;\r\n";
            ___result += "\r\n";
            ___result += "        public void SetAction(BtnEvent action, string pk)\r\n";
            ___result += "        {\r\n";
            ___result += "            fAction = action;\r\n";
            ___result += "           \r\n";
            ___result += "            switch (fAction)\r\n";
            ___result += "            {\r\n";
            ___result += "                case BtnEvent.Open:\r\n";
            ___result += "                    btn_save.Text = \"&CLOSE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.New:\r\n";
            ___result += "                    btn_save.Text = \"&SAVE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + ".GetNew;\r\n";
            ___result += "                    this.EnableControls(true);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Edit:\r\n";
            ___result += "                    btn_save.Text = \"&UPDATE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    this.EnableControls(true);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Delete:\r\n";
            ___result += "                    btn_save.Text = \"CONFIRM\\r\\n&DELETE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Print:\r\n";
            ___result += "                    btn_save.Text = \"&PRINT\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "           \r\n";
            ___result += "            this.LoadData();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Action]\r\n";
            ___result += "\r\n";

            #endregion[Action]

            #region[Load Data]

            ___result += "        #region[Load Data]\r\n";
            ___result += "\r\n";
            ___result += "        private void LoadData()\r\n";
            ___result += "        {\r\n";
            ___result += "            vId = obj." + UPPERFIRST + "_id;\r\n";

            for (int r = 0; r < list.Count; r++)
            {

                //if (list[r].Inputtype == InputControls.LOOKUPBOX)
                //{
                //    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Text =  C" + (list[r].Fieldsname.UpperFirst()) + "_exten.GetName_Id(obj." + list[r].Fieldsname.UpperFirst() + ");\r\n";


                //}
                //else
                //{
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Text = obj." + list[r].Fieldsname.UpperFirst() + ";\r\n";
           // }
        }
            ___result += "            txt_notes.Text = obj.Notes;\r\n";
            ___result += "            Core.Stative = obj.Active_id;\r\n";
            ___result += "            Setactives();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Load Data]\r\n";
            ___result += "\r\n";

            #endregion[Load Data]

            #region[Enable  Disable Controls]

            ___result += "        #region[Enable  Disable Controls]\r\n";
            ___result += "\r\n";
            ___result += "        private void EnableControls(bool pEnabled)\r\n";
            ___result += "        {\r\n";
            ___result += "            bool pReadOnly = !pEnabled;\r\n";
            ___result += "           \r\n";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Enabled = !pReadOnly;\r\n";
            }
            ___result += "            txt_notes.Enabled = !pReadOnly;\r\n";
            ___result += "           \r\n";
            ___result += "            btn_active.Enabled = !pReadOnly;\r\n";
            ___result += "           \r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Enable  Disable Controls]\r\n";
            ___result += "\r\n";

            #endregion[Enable  Disable Controls]

            #region[Save Event]

            ___result += "        #region[Save Event]\r\n";
            ___result += "\r\n";
            ___result += "        private " + xDAL + " dalsession;\r\n";

            ___result += "        private void Save_Event()\r\n";
            ___result += "        {\r\n";
            ___result += "            if (Validation() != false)\r\n";
            ___result += "            {\r\n";
            ___result += "                switch (fAction)\r\n";
            ___result += "                {\r\n";
            ___result += "                                        case BtnEvent.Open: \r\n ";
            ___result += "                                            this.Hide(); \r\n ";
            ___result += "                                            Form_NeedToRefresh(); \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n ";
            ___result += "                                        case BtnEvent.New: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                var vData = CollectData(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                dalsession = new " + xDAL + "(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Insert(vData, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Saved Successfully.\", \"Save...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Save...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n ";
            ___result += "                                        case BtnEvent.Edit: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                var vData = CollectData(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                dalsession = new " + xDAL + "(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Update(vData, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Updated Successfully.\", \"Update...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "                                         \r\n ";
            ___result += "                                        case BtnEvent.Delete: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                dalsession = new " + xDAL + "(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Delete(vId, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Deleted Successfully.\", \"Delete...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n";
            ___result += "                    case BtnEvent.Print:\r\n";
            ___result += "                        this.Hide();\r\n";
            ___result += "                        Form_NeedToRefresh();\r\n";
            ___result += "                        break;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Save Event]\r\n";
            ___result += "\r\n";

            #endregion[Event]

            #region[Collect Data]

            ___result += "        #region[Collect Data]\r\n";
            ___result += "\r\n";
            ___result += "        private " + UPPERFIRST + " CollectData()\r\n";
            ___result += "        {\r\n";
            ___result += "            " + UPPERFIRST + " fobj = new " + UPPERFIRST + "()\r\n";
            ___result += "           {\r\n";
            ___result += "                " + UPPERFIRST + "_id = vId,\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype == InputControls.LOOKUPBOX)
                {
                    ___result += "                " + list[r].Fieldsname.UpperFirst() + " = C" + (list[r].Fieldsname.UpperFirst()).Replace("_id", "") + "_exten.GetId_Name(txt_" + list[r].Fieldsname.ToLower() + ".Text),\r\n";
                }
                else
                {
                    ___result += "                " + list[r].Fieldsname.UpperFirst() + " = txt_" + list[r].Fieldsname.ToLower() + ".Text,\r\n";
                }
            }

            ___result += "                Active_id = Core.Stative,\r\n";
            ___result += "                Notes = txt_notes.Text,\r\n";
            ___result += "                User_id = Current.User\r\n";
            ___result += "            };\r\n";
            ___result += "            return fobj;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[CollectData]\r\n";
            ___result += "\r\n";

            #endregion[Collect Data]

            #region[Validation]

            ___result += "        #region[Validation]\r\n";
            ___result += "\r\n";
            ___result += "        private bool Validation()\r\n";
            ___result += "        {\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Validate == AutoCode.YES)
                {
                    ___result += "            if (txt_" + list[r].Fieldsname.ToLower() + ".Text.Trim().Length == 0)\r\n";
                    ___result += "            {\r\n";
                    ___result += "                MessageBox.Show(this.FindForm(), \"" + (list[r].Fieldsname.UpperFirst()).Replace("_", " ") + " should not Empty ! \", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n";
                    ___result += "                txt_" + list[r].Fieldsname.ToLower() + ".Focus();\r\n";
                    ___result += "                return false;\r\n";
                    ___result += "            }\r\n";
                    ___result += "           \r\n";
                }
            }

            ___result += "            if (Core.Stative == Core.Idle)\r\n";
            ___result += "            {\r\n";
            ___result += "                MessageBox.Show(this.FindForm(), \"Select Active or not !\", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n";
            ___result += "                btn_active.Focus();\r\n";
            ___result += "                return false;\r\n";
            ___result += "            }\r\n";
            ___result += "           \r\n";
            ___result += "            return true;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Validation]\r\n";
            ___result += "\r\n";

            #endregion[Validation]

            #region[result]

            ___result += "}//cls \r\n";
            ___result += "}//ns \r\n";

            return ___result;

            #endregion[result]

        }
コード例 #17
0
ファイル: SForm_exten.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List<SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// " + DateTime.Now + "\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region[using]

            ___result += "using System;\r\n";
            //___result += "using System.ComponentModel;\r\n";
            //___result += "using System.Collections.Generic;\r\n";
            ___result += "using System.Drawing;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using CXCORE;\r\n";
            ___result += "\r\n";

            #endregion[using]

            #region[namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public partial class F" + UPPERFIRST + " : UserControl\r\n";
            ___result += "    {\r\n";

            #endregion[namespace]

            #region[Grid Event]

            ___result += "        #region[Grid Event]\r\n";
            ___result += "\r\n";
            ___result += "        void Editgrid_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            CalcTotals();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void Editgrid_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (e.FormattedValue + \"\" == \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                return;\r\n";
            ___result += "            }\r\n";
            ___result += "            string vColName = editgrid.Columns[e.ColumnIndex].Name;\r\n";
            ___result += "            switch (vColName)\r\n";
            ___result += "            {\r\n";
            ___result += "                case " + CAPITAL + "ITEMS.QTY:\r\n";
            ___result += "                    decimal newDecimal;\r\n";
            ___result += "                    if (decimal.TryParse(e.FormattedValue.ToString(), out newDecimal) == false || newDecimal < 0)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        MessageBox.Show(this.FindForm(), \"The value must be an number.\", \"Number Check...\", MessageBoxButtons.OK, MessageBoxIcon.Information);\r\n";
            ___result += "                        editgrid.CancelEdit();\r\n";
            ___result += "                        e.Cancel = true;\r\n";
            ___result += "                    }\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void Editgrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            string vColName = editgrid.Columns[e.ColumnIndex].Name;\r\n";
            ___result += "            if (vColName != Core.SLNO && editgrid[Core.SLNO, e.RowIndex].Value + \"\" != \"*\")\r\n";
            ___result += "            {\r\n";
            ___result += "                for (int r = 0; r < editgrid.RowCount; r++)\r\n";
            ___result += "                {\r\n";
            ___result += "                    DataGridViewRow row = editgrid.Rows[r];\r\n";
            ___result += "                    row.Cells[Core.SLNO].Value = \" \" + (r + 1) + \"\";\r\n";
            ___result += "                    CalcTotals();\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "            switch (vColName)\r\n";
            ___result += "            {\r\n";
            ___result += "                case " + CAPITAL + "ITEMS.QTY:\r\n";
            if (obj.STables.Stables_id != "2")
            {
                ___result += "                    CalcAmount(e.RowIndex);\r\n";
            }
            ___result += "                    CalcTotals();\r\n";
            ___result += "                    break;\r\n";
            if (obj.STables.Stables_id != "2")
            {
                ___result += "                case " + CAPITAL + "ITEMS.PRICE:\r\n";
                ___result += "                    CalcAmount(e.RowIndex);\r\n";
                ___result += "                    CalcTotals();\r\n";
                ___result += "                    break;\r\n";
            }
            ___result += "            }\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void Editgrid_CurrentCellChanged(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (editgrid.Focused == false)\r\n";
            ___result += "            {\r\n";
            ___result += "                return;\r\n";
            ___result += "            }\r\n";
            ___result += "            if (editgrid.ReadOnly == true)\r\n";
            ___result += "            {\r\n";
            ___result += "                return;\r\n";
            ___result += "            }\r\n";
            ___result += "            if (editgrid.CurrentCell != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                lookupRow = editgrid.CurrentCell.RowIndex;\r\n";
            ___result += "                lookupCol = editgrid.CurrentCell.ColumnIndex;\r\n";
            ___result += "                lookupColName = editgrid.Columns[lookupCol].Name;\r\n";
            ___result += "\r\n";
            ___result += "                switch (lookupColName)\r\n";
            ___result += "                {\r\n";
            ___result += "                    case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n";
            ___result += "                        ShowLookupForm();\r\n";
            ___result += "                        break;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Grid Event]\r\n";
            ___result += "\r\n";

            #endregion[Grid Event]

            #region[Calc Total]

            ___result += "        #region[Calc Total]\r\n";

            if (obj.STables.Stables_id != "2")
            {
                ___result += "\r\n";
                ___result += "        private void CalcAmount(int pRowIndex)\r\n";
                ___result += "        {\r\n";
                ___result += "            decimal vQty = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.QTY, pRowIndex].Value);\r\n";
                ___result += "            decimal vPrice = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.PRICE, pRowIndex].Value);\r\n";
                ___result += "            decimal vAmount = vQty * vPrice;\r\n";
                ___result += "            editgrid[" + CAPITAL + "ITEMS.SUB_TOTAL , pRowIndex].Value = ConvertTO.Decimal2d(vAmount.ToString());\r\n";
                ___result += "        }\r\n";
                ___result += "\r\n";
            }
            ___result += "        private void CalcTotals()\r\n";
            ___result += "        {\r\n";
            ___result += "            decimal vTotQty = 0M;\r\n";
            if (obj.STables.Stables_id != "2")
            {
                ___result += "            decimal vSubTotal = 0M;\r\n";
            }
            ___result += "            for (int r = 0; r <= editgrid.Rows.Count - 1; r++)\r\n";
            ___result += "            {\r\n";
            ___result += "                decimal vQty = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.QTY, r].Value);\r\n";
            ___result += "                vTotQty += vQty;\r\n";
            if (obj.STables.Stables_id != "2")
            {
                ___result += "                decimal vTotal = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.SUB_TOTAL, r].Value);\r\n";
                ___result += "                vSubTotal += vTotal;\r\n";
            }
            ___result += "            }\r\n";
            ___result += "            //\r\n";
            ___result += "            txt_total_qty.Text = vTotQty.ToString();\r\n";
            if (obj.STables.Stables_id != "2")
            {
                ___result += "            txt_total_amount.Text = vSubTotal.ToString();\r\n";
            }
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Calc Total]\r\n";
            ___result += "\r\n";

            #endregion[Calc Total]

            #region[Look up]

            ___result += "        #region[Look up]\r\n";
            ___result += "\r\n";
            ___result += "        private int lookupRow;\r\n";
            ___result += "        private int lookupCol;\r\n";
            ___result += "        private string lookupColName;\r\n";
            ___result += "        private LookupForm frmLookup;\r\n";
            ___result += "        public void ShowLookupForm()\r\n";
            ___result += "        {\r\n";
            ___result += "            FrmLookup_LookupHide(null, null);\r\n";
            ___result += "\r\n";
            ___result += "            frmLookup = new LookupForm();\r\n";
            ___result += "\r\n";
            ___result += "            switch (lookupColName)\r\n";
            ___result += "            {\r\n";
            ___result += "\r\n";
            ___result += "                case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n";
            ___result += "                    {\r\n";
            ___result += "                        frmLookup.LookupColNames = new string[] { PRODUCT.PRODUCT_NAME };\r\n";
            ___result += "                        frmLookup.SelectedPkValue = editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value;\r\n";
            ___result += "                        frmLookup.AllowNewEntry = true;\r\n";
            ___result += "                        frmLookup.AllowEmptySelection = true;\r\n";
            ___result += "                     \r\n";
            ___result += "                        if (txt_party_id.Text != \"\")\r\n";
            ___result += "                        {\r\n";
            ___result += "                            frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());\r\n";
            ___result += "                            frmLookup.LoadLookupList();\r\n";
            ___result += "                        }\r\n";
            ___result += "                    }\r\n";
            ___result += "                    break;\r\n";
            ___result += "\r\n";
            ___result += "                default:\r\n";
            ___result += "                    throw new System.Exception(\"'\" + lookupColName + \"' Not Found\");\r\n";
            ___result += "            }\r\n";
            ___result += "            frmLookup.LookupSelected += new EventHandler(FrmLookup_LookupSelected);\r\n";
            ___result += "            frmLookup.AfterSelection += new EventHandler(FrmLookup_AfterSelection);\r\n";
            ___result += "            frmLookup.LookupHide += new EventHandler(FrmLookup_LookupHide);\r\n";
            ___result += "            frmLookup.NewEntryNeeded += new LookupForm.NewEntryHandler(FrmLookup_NewEntryNeeded);\r\n";
            ___result += "            frmLookup.Owner = this.FindForm();\r\n";
            ___result += "            //////////\r\n";
            ___result += "            frmLookup.Show();\r\n";
            ___result += "            //////////\r\n";
            ___result += "            int vWidth = frmLookup.GetAutoWidth();\r\n";
            ___result += "            int vCellWidth = editgrid.Columns[lookupColName].Width;\r\n";
            ___result += "            if (vWidth < vCellWidth) vWidth = vCellWidth;\r\n";
            ___result += "            frmLookup.AutoFillLastColumn();\r\n";
            ___result += "\r\n";
            ___result += "            int vHeight = frmLookup.GetAutoHeight();\r\n";
            ___result += "\r\n";
            ___result += "            Rectangle screenRect = Global.GetScreenRect(editgrid);\r\n";
            ___result += "            frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void FrmLookup_LookupSelected(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            System.Data.DataRow vEntity = frmLookup.SelectedEntity;\r\n";
            ___result += "\r\n";
            ___result += "            switch (lookupColName)\r\n";
            ___result += "            {\r\n";
            ___result += "                case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n";
            ___result += "                    if (vEntity == null)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = \"\";\r\n";
            ___result += "                    }\r\n";
            ___result += "                    else\r\n";
            ___result += "                    {\r\n";
            ___result += "                        editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = vEntity[PRODUCT.PRODUCT_NAME];\r\n";
            ___result += "                    }\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void FrmLookup_AfterSelection(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            editgrid.FocusNextCell();\r\n";
            ___result += "        }\r\n";
            ___result += "        void FrmLookup_LookupHide(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            Application.DoEvents();\r\n";
            ___result += "            Application.DoEvents();\r\n";
            ___result += "            if (frmLookup != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                frmLookup.Dispose();\r\n";
            ___result += "                frmLookup = null;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        void FrmLookup_NewEntryNeeded(object sender, string pValue)\r\n";
            ___result += "        {\r\n";
            ___result += "            switch (lookupColName)\r\n";
            ___result += "            {\r\n";
            ___result += "                case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n";
            ___result += "                    FproductNewEntry(pValue);\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Look up]\r\n";
            ___result += "\r\n";

            #endregion[Look up]

            #region [New Entry]

            ___result += "        #region [New Entry]\r\n";
            ___result += "\r\n";
            ___result += "        private FProduct xproduct = null;\r\n";
            ___result += "        void FproductNewEntry(string pValue)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (xproduct == null)\r\n";
            ___result += "            {\r\n";
            ___result += "                xproduct = new FProduct();\r\n";
            ___result += "                xproduct.FProduct_NeedToRefresh += Xproduct_refresh;\r\n";
            ___result += "            }\r\n";
            ___result += "            this.Parent.Controls.Add(xproduct);\r\n";
            ___result += "            xproduct.Dock = DockStyle.Fill;\r\n";
            ___result += "            xproduct.Show();\r\n";
            ___result += "            xproduct.BringToFront();\r\n";
            ___result += "            xproduct.Focus();\r\n";
            ___result += "            xproduct.SetAction(BtnEvent.New, null);\r\n";
            ___result += "            xproduct.SetFocus();\r\n";
            ___result += "            xproduct.setname(pValue);\r\n";
            ___result += "        }\r\n";
            ___result += "        private void Xproduct_refresh(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = xproduct.GetName();\r\n";
            ___result += "            editgrid.Focus();\r\n";
            ___result += "            editgrid.CurrentCell = editgrid[" + CAPITAL + "ITEMS.QTY, lookupRow];\r\n";
            ___result += "\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion [New Entry]\r\n";
            ___result += "\r\n";

            #endregion [New Entry]

            #region[result]

            ___result += "}//cls\r\n";
            ___result += "}//ns\r\n";

            return ___result;

            #endregion[result]

        }
コード例 #18
0
        private static string XCreate(MasterDetails obj)
        {
            List<MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result = "";

            // string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region[using ]

            ___result += "using System;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using System.Drawing;\r\n";
            ___result += "using System.ComponentModel;\r\n";
            ___result += "\r\n";

            #endregion[using ]

            #region[namespace ]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class F" + UPPERFIRST + " : CxControl \r\n";
            ___result += "    { \r\n";
            ___result += "        public F" + UPPERFIRST + "() \r\n";
            ___result += "        {\r\n";
            ___result += "            InitializeComponent();\r\n";
            ___result += "            Initialize();\r\n";
            ___result += "            Setactives();\r\n";
            ___result += "            SetFocus(); \r\n";

            #region[add Lookup]

            for (int r = 0; r < list.Count; r++)
            {
                if ((list[r].Inputtype == InputControls.LOOKUPBOX) || (list[r].Inputtype == InputControls.LOOKUPBOX_FIRST))
                {
                    ___result += "            " + list[r].Fieldsname.UpperFirst().Replace("_id", "") + "_lookup(); \r\n";
                }
            }
            ___result += "        }\r\n";
            ___result += "        \r\n";
            #endregion[add Lookup]

            #endregion[namespace ]

            #region[Private Variable] 

            ___result += "        #region [Private Declare]\r\n";
            ___result += "\r\n";
            ___result += "        private Timer splitTimer;\r\n";
            ___result += "        private SplitContainer split_container;\r\n";
            ___result += "        private XShadowPanel fpanel;\r\n";
            ___result += "        private Panel finner_panel;\r\n";
            ___result += "        private CloseButton btn_close;\r\n";
            ___result += "        private Header lbl_header;\r\n";
            ___result += "        private OfficeButton btn_list;\r\n";
            ___result += "        private OfficeButton btn_new;\r\n";
            ___result += "        private OfficeButton btn_edit;\r\n";
            ___result += "        private OfficeButton btn_delete;\r\n";
            ___result += "        private OfficeButton btn_print;\r\n";
            ___result += "        private OfficeButton btn_splitter;\r\n";
            ___result += "\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "        private " + InputControls.Get(list[r].Inputtype) + " txt_" + list[r].Fieldsname.ToLower() + ";\r\n";
                ___result += "        private XLabel lbl_" + list[r].Fieldsname.ToLower() + ";\r\n";
            }

            ___result += "\r\n";
            ___result += "        private RichTextBox txt_notes;\r\n";
            ___result += "        private XLabel lbl_notes;\r\n";
            ___result += "        private OfficeButton btn_save;\r\n";
            ___result += "        private OfficeButton btn_active;\r\n";
            ___result += "\r\n";
            ___result += "        #endregion [Private Declare]\r\n";
            ___result += "\r\n";

            #endregion[Declare Private]

            #region [Initialize]

            ___result += "        private void Initialize() \r\n";
            ___result += "        { \r\n";
            ___result += "\r\n";

            #region[declare new]

            ___result += "            #region[declare new]\r\n";
            ___result += "\r\n";
            ___result += "            components = new Container();\r\n";
            ___result += "            splitTimer = new Timer(components);\r\n";
            ___result += "            split_container = new SplitContainer();\r\n";
            ___result += "            fpanel = new XShadowPanel();\r\n";
            ___result += "            finner_panel = new Panel();\r\n";
            ___result += "            btn_list = new OfficeButton();\r\n";
            ___result += "            btn_new = new OfficeButton();\r\n";
            ___result += "            btn_edit = new OfficeButton();\r\n";
            ___result += "            btn_delete = new OfficeButton();\r\n";
            ___result += "            btn_print = new OfficeButton();\r\n";
            ___result += "            btn_splitter = new OfficeButton();\r\n";
            ___result += "            lbl_header = new Header();\r\n";
            ___result += "            btn_close = new CloseButton();\r\n";
            ___result += "\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "            txt_" + list[r].Fieldsname.ToLower() + " = new " + InputControls.Get(list[r].Inputtype) + "();\r\n";
                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + " = new XLabel();\r\n";
            }

            ___result += "\r\n";
            ___result += "            txt_notes = new RichTextBox();\r\n";
            ___result += "            lbl_notes = new XLabel();\r\n";
            ___result += "            btn_save = new OfficeButton();\r\n";
            ___result += "            btn_active = new OfficeButton();\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[declare new]\r\n";
            ___result += "\r\n";

            #endregion[declare new]

            #region[container suspend]

            ___result += "            #region[container suspend]\r\n";
            ___result += "\r\n";
            ___result += "            ((ISupportInitialize)(split_container)).BeginInit();\r\n";
            ___result += "            split_container.Panel1.SuspendLayout();\r\n";
            ___result += "            split_container.Panel2.SuspendLayout();\r\n";
            ___result += "            split_container.SuspendLayout();\r\n";
            ___result += "            fpanel.SuspendLayout();\r\n";
            ___result += "            finner_panel.SuspendLayout();\r\n";
            ___result += "            SuspendLayout();\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[container suspend]\r\n";
            ___result += "\r\n";

            #endregion[container suspend]

            #region[splitTimer]

            ___result += "            #region[splitTimer]\r\n";
            ___result += "\r\n";
            ___result += "            splitTimer.Interval = 2;\r\n";
            ___result += "            splitTimer.Tick += new EventHandler(SplitTimer_Tick);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[splitTimer]\r\n";
            ___result += "\r\n";

            #endregion[splitTimer]

            #region[split_container]

            ___result += "            #region[split_container]\r\n";
            ___result += "\r\n";
            ___result += "            split_container.Dock = DockStyle.Fill;\r\n";
            ___result += "            split_container.Location = new Point(0, 0);\r\n";
            ___result += "            split_container.Name = \"split_container\";\r\n";
            ___result += "            split_container.BackColor = XTheme.Splitcontainer_colour;\r\n";
            ___result += "            split_container.Size = XSize.FSplitcontainer;\r\n";
            ___result += "            split_container.SplitterDistance = XSize.Screen_Width;\r\n";
            ___result += "            split_container.TabIndex = XTab.Splitcontainer;\r\n";
            ___result += "\r\n";
            ___result += "            // split_container.Panel1\r\n";
            ___result += "\r\n";
            ___result += "            split_container.Panel1.Controls.Add(fpanel);\r\n";
            ___result += "\r\n";

            #region[split_container.Panel2]

            ___result += "            #region[split_container.Panel2]\r\n";
            ___result += "\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_print);\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_delete);\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_edit);\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_new);\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_list);\r\n";
            ___result += "            split_container.Panel2.Controls.Add(btn_splitter);\r\n";
            ___result += "\r\n";
            ___result += "            btn_list.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_list.Location =  XLayout.FormFirstBtn;\r\n";
            ___result += "            btn_list.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_list.TabIndex = 1;\r\n";
            ___result += "            btn_list.Name = \"btn_list\";\r\n";
            ___result += "            btn_list.Text = \"&List\";\r\n";
            ___result += "            btn_list.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_list.Click += Btn_list_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_new.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_new.Location = XLayout.BtnLocation(btn_list.Location);\r\n";
            ___result += "            btn_new.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_new.TabIndex = XTab.Index(btn_list.TabIndex);\r\n";
            ___result += "            btn_new.Name = \"btn_new\";\r\n";
            ___result += "            btn_new.Text = \"&New\";\r\n";
            ___result += "            btn_new.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_new.Click += Btn_new_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_edit.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_edit.Location = XLayout.BtnLocation(btn_new.Location);\r\n";
            ___result += "            btn_edit.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_edit.TabIndex = XTab.Index(btn_new.TabIndex);\r\n";
            ___result += "            btn_edit.Name = \"btn_edit\";\r\n";
            ___result += "            btn_edit.Text = \"&Edit\";\r\n";
            ___result += "            btn_edit.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_edit.Click += Btn_edit_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_delete.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_delete.Location = XLayout.BtnLocation(btn_edit.Location);\r\n";
            ___result += "            btn_delete.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_delete.TabIndex = XTab.Index(btn_edit.TabIndex);\r\n";
            ___result += "            btn_delete.Name = \"btn_delete\";\r\n";
            ___result += "            btn_delete.Text = \"&Delete\";\r\n";
            ___result += "            btn_delete.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_delete.Click += Btn_delete_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_print.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_print.Location = XLayout.BtnLocation(btn_delete.Location);\r\n";
            ___result += "            btn_print.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_print.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n";
            ___result += "            btn_print.Name = \"btn_print\";\r\n";
            ___result += "            btn_print.Text = \"&Print\";\r\n";
            ___result += "            btn_print.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_print.Click += Btn_print_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_splitter.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_splitter.Location = XLayout.Splitter;\r\n";
            ___result += "            btn_splitter.Size = XSize.Splitter;\r\n";
            ___result += "            btn_splitter.TabIndex = XTab.Index(btn_print.TabIndex);\r\n";
            ___result += "            btn_splitter.Name = \"btn_splitter\";\r\n";
            ___result += "            btn_splitter.Text = \"⁞⁞\";\r\n";
            ___result += "            btn_splitter.Themes = XTheme.WhiteBtn;\r\n";
            ___result += "            btn_splitter.Click += new EventHandler(Btn_splitter_Click);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[split_container.Panel2]\r\n";
            ___result += "\r\n";

            #endregion[split_container.Panel2]

            ___result += "            #endregion[split_container]\r\n";
            ___result += "\r\n";

            #endregion[split_container]

            #region[fpanel]

            ___result += "            #region[fpanel]\r\n";
            ___result += "\r\n";
            ___result += "            fpanel.Name = \"fpanel\";\r\n";
            ___result += "            fpanel.Anchor = XAnchor.LTR;\r\n";
            ___result += "            fpanel.Size =  XSize.FPanel;\r\n";
            ___result += "            fpanel.Location = XLayout.FPanel;\r\n";
            ___result += "            fpanel.BackColor = XTheme.FPanel;\r\n";
            ___result += "            fpanel.Controls.Add(finner_panel);\r\n";
            ___result += "            fpanel.Controls.Add(btn_close);\r\n";
            ___result += "            fpanel.Controls.Add(lbl_header);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[fpanel]\r\n";
            ___result += "\r\n";

            #endregion[fpanel]

            #region[finner_panel]

            ___result += "            #region[finner_panel]\r\n";
            ___result += "\r\n";
            ___result += "            finner_panel.Anchor = XAnchor.LTR;\r\n";
            ___result += "            finner_panel.Cursor = Cursors.Default;\r\n";
            ___result += "            finner_panel.Name = \"finner_panel\";\r\n";
            ___result += "            finner_panel.Size = XSize.FInnerPanel;\r\n";
            ___result += "            finner_panel.Location = XLayout.FInnerPanel;\r\n";
            ___result += "            finner_panel.BackColor = XTheme.FInnerpanel;\r\n";
            ___result += "            finner_panel.AutoScroll = true;\r\n";
            ___result += "\r\n";

            #region[adding controls]

            ___result += "            #region[adding controls]\r\n";
            ___result += "\r\n";

            ___result += "            finner_panel.Controls.Add(txt_notes);\r\n";
            ___result += "            finner_panel.Controls.Add(lbl_notes);\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "            finner_panel.Controls.Add(txt_" + list[r].Fieldsname.ToLower() + ");\r\n";
                ___result += "            finner_panel.Controls.Add(lbl_" + list[r].Fieldsname.ToLower() + ");\r\n";
            }

            ___result += "            finner_panel.Controls.Add(btn_save);\r\n";
            ___result += "            finner_panel.Controls.Add(btn_active);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[adding controls]\r\n";
            ___result += "\r\n";

            #endregion[adding btn] 

            #region[Properties of Header]

            ___result += "            #region[Header]\r\n";
            ___result += "\r\n";
            ___result += "            btn_close.Click += new EventHandler(Btn_close_Click);\r\n";
            ___result += "\r\n";
            ___result += "            lbl_header.Text = \"" + ((obj.Mastertable.Alias).Replace("_", " ")).UpperFirst() + "\";\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[Header]\r\n";
            ___result += "\r\n";

            #endregion[Header] 

            #region[Properties of control]

            ___result += "            #region[Properties of control]\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {

                    #region[lbl Properties]

                    string hlblp = "";

                    ___result += "\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Font = XFont.Font_10B;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Name = \"lbl_" + list[r].Fieldsname.ToLower() + "\";\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Text = \"   " + (ChangeCase.UpperFirst(list[r].Displayname.ToLower())).Replace("_", " ") + "\";\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LT;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".TextAlign = ContentAlignment.MiddleLeft;\r\n";
                    ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".ForeColor = XFontColor.Lbl_ForeColor;\r\n";

                    switch (list[r].Width)
                    {
                        case AutoCode.C1:
                            ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.OneLabel;\r\n";

                            //switch (list[r].Cposition)
                            //{
                            //    case AutoCode.P1:
                            hlblp = AutoCode.R1_Label;
                            //        break;
                            //}

                            break;

                        case AutoCode.C2:
                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.OneLabel;\r\n";
                            }
                            else
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.TwoLabel;\r\n";
                            }

                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:

                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_2Label_1;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_2Label_1;
                                    }
                                    break;

                                case AutoCode.P2:

                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_2Label_2;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_2Label_2;
                                    }

                                    break;
                            }

                            break;

                        case AutoCode.C3:
                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.OneLabel;\r\n";
                            }
                            else
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.ThreeLabel;\r\n";
                            }

                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_3Label_1;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_3Label_1;
                                    }
                                    break;

                                case AutoCode.P2:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_3Label_2;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_3Label_2;
                                    }
                                    break;

                                case AutoCode.P3:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_3Label_3;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_3Label_3;
                                    }
                                    break;
                            }

                            break;

                        case AutoCode.C4:
                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.OneLabel;\r\n";
                            }
                            else
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.FourLabel;\r\n";
                            }

                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_4Label_1;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_4Label_1;
                                    }
                                    break;

                                case AutoCode.P2:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_4Label_2;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_4Label_2;
                                    }
                                    break;

                                case AutoCode.P3:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_4Label_3;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_4Label_3;
                                    }
                                    break;

                                case AutoCode.P4:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        hlblp = AutoCode.R1_4Label_4;
                                    }
                                    else
                                    {
                                        hlblp = AutoCode.R2_4Label_4;
                                    }
                                    break;
                            }

                            break;
                    }

                    switch (list[r].Inputtype)
                    {
                        case InputControls.TEXTBOX_FIRST:
                            ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstLabel;\r\n";
                            break;
                        case InputControls.LOOKUPBOX_FIRST:
                            ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstLabel;\r\n";
                            break;
                        case InputControls.NUMBERBOX_FIRST:
                            ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstLabel;\r\n";
                            break;
                        case InputControls.DATETIMEBOX_FIRST:
                            ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstLabel;\r\n";
                            break;
                        default:

                            if (r != 0)
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout." + hlblp + "(lbl_" + list[r - 1].Fieldsname.ToLower() + ".Location);\r\n";
                            }
                            else
                            {
                                ___result += "            lbl_" + list[r].Fieldsname.ToLower() + ".Location =XLayout." + hlblp + "(lbl_" + list[r].Fieldsname.ToLower() + ".Location);\r\n";
                            }

                            break;
                    }

                    #endregion[LBL Properties]

                    #region[Text Properties]

                    string htxtp = "";


                    ___result += "\r\n";
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Font = XFont.TxtFont;\r\n";
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".ForeColor = XFontColor.TxtFontColor;\r\n";
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".BackColor = XTheme.TxtBackcolor;\r\n";

                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Name = \"txt_" + list[r].Fieldsname.ToLower() + "\";\r\n";

                    switch (list[r].Inputtype)
                    {
                        case InputControls.DATEBOX:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".CustomFormat = \"" + InputControls.Datebox_format + "\";\r\n";
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Format = DateTimePickerFormat.Custom;\r\n";
                            break;
                        case InputControls.DATETIMEBOX:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".CustomFormat = \"" + InputControls.Datetimebox_format + "\";\r\n";
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Format = DateTimePickerFormat.Custom;\r\n";
                            break;
                        case InputControls.TIMEBOX:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".CustomFormat = \"" + InputControls.Timebox_format + "\";\r\n";
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Format = DateTimePickerFormat.Custom;\r\n";
                            break;
                        default:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n";
                            break;
                    }

                    switch (list[r].Width)
                    {
                        case AutoCode.C1:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.OneText;\r\n";
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LTR;\r\n";

                            htxtp = AutoCode.R1_Text;

                            break;

                        case AutoCode.C2:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.TwoText;\r\n";

                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LT;\r\n";
                            }
                            else
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LTR;\r\n";
                            }

                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_2Text_1;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_2Text_1;
                                    }
                                    break;

                                case AutoCode.P2:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_2Text_2;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_2Text_2;
                                    }
                                    break;
                            }

                            break;

                        case AutoCode.C3:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.ThreeText;\r\n";
                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LT;\r\n";
                            }
                            else
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LTR;\r\n";
                            }
                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_3Text_1;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_3Text_1;
                                    }
                                    break;

                                case AutoCode.P2:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_3Text_2;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_3Text_2;
                                    }
                                    break;

                                case AutoCode.P3:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_3Text_3;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_3Text_3;
                                    }
                                    break;
                            }

                            break;

                        case AutoCode.C4:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Size =  XSize.FourText;\r\n";
                            if (list[r].Cposition == AutoCode.P1)
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LT;\r\n";
                            }
                            else
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Anchor = XAnchor.LTR;\r\n";
                            }

                            switch (list[r].Cposition)
                            {
                                case AutoCode.P1:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_4Text_1;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_4Text_1;
                                    }
                                    break;

                                case AutoCode.P2:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_4Text_2;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_4Text_2;
                                    }
                                    break;

                                case AutoCode.P3:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_4Text_3;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_4Text_3;
                                    }
                                    break;

                                case AutoCode.P4:
                                    if (list[r].Rposition == AutoCode.SAME_ROW)
                                    {
                                        htxtp = AutoCode.R1_4Text_4;
                                    }
                                    else
                                    {
                                        htxtp = AutoCode.R2_4Text_4;
                                    }
                                    break;
                            }

                            break;
                    }



                    switch (list[r].Inputtype)
                    {
                        case InputControls.TEXTBOX_FIRST:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstText;\r\n";
                            break;
                        case InputControls.LOOKUPBOX_FIRST:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstText;\r\n";
                            break;
                        case InputControls.NUMBERBOX_FIRST:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstText;\r\n";
                            break;
                        case InputControls.DATETIMEBOX_FIRST:
                            ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Location =XLayout.FirstText;\r\n";
                            break;
                        default:

                            if (r != 0)
                            {
                                ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Location =XLayout." + htxtp + "(txt_" + list[r - 1].Fieldsname.ToLower() + ".Location);\r\n";
                            }
                            

                            break;

                    }


                    if ((list[r].Inputtype == InputControls.TEXTBOX_FIRST) || (list[r].Inputtype == InputControls.LOOKUPBOX_FIRST)|| (list[r].Inputtype == InputControls.DATEBOX_FIRST))/////// tab index
                    {
                        ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".TabIndex = XTab.Txt_TabIndex;\r\n";
                    }
                    else
                    {
                        ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".TabIndex = XTab.Index(txt_" + list[r - 1].Fieldsname.ToLower() + ".TabIndex);\r\n";
                    }

                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Enter += new EventHandler(Txt_" + list[r].Fieldsname.ToLower() + "_Enter);\r\n";
                    ___result += "\r\n";

                    #endregion[Text Properties]
                }
            }
            #region[Notes Properties]

            ___result += "\r\n";
            ___result += "            lbl_notes.Font = XFont.Font_10B;\r\n";
            ___result += "            lbl_notes.ForeColor = XFontColor.Lbl_ForeColor;\r\n";
            ___result += "            lbl_notes.Location = XLayout.LblNotes;\r\n";
            ___result += "            lbl_notes.Size = XSize.LblNotes;\r\n";
            ___result += "            lbl_notes.Anchor = XAnchor.LB;\r\n";
            ___result += "            lbl_notes.Name = \"lbl_notes\";\r\n";
            ___result += "            lbl_notes.Text = \"   Notes\";\r\n";
            ___result += "            lbl_notes.TextAlign = ContentAlignment.MiddleLeft;\r\n";
            ___result += "            lbl_notes.Click += new EventHandler(Lbl_notes_Click);\r\n";
            ___result += "\r\n";
            ___result += "            txt_notes.Font = Theme.txtFont;\r\n";
            ___result += "            txt_notes.ForeColor = Theme.txtForeColor;\r\n";
            ___result += "            txt_notes.BackColor = Theme.White;\r\n";
            ___result += "            txt_notes.Location = XLayout.TxtNotes;\r\n";
            ___result += "            txt_notes.Size =  XSize.TxtNotes;\r\n";
            ___result += "            txt_notes.Name = \"txt_notes\";\r\n";
            ___result += "            txt_notes.Anchor = XAnchor.LRB;\r\n";
            ___result += "            txt_notes.TabIndex = XTab.Index(txt_notes.TabIndex);\r\n";
            ___result += "            txt_notes.Enter += new EventHandler(Txt_notes_Enter);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[Properties of control]\r\n";
            ___result += "\r\n";

            #endregion[Notes Properties]

            #endregion[Properties of control]

            #region[Properties of btn]

            ___result += "            #region[Properties of btn]\r\n";
            ___result += "\r\n";
            ___result += "            btn_save.Anchor = XAnchor.RB;\r\n";
            ___result += "            btn_save.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_save.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_save.Location = XLayout.BtnSave;\r\n";
            ___result += "            btn_save.TabIndex = XTab.Index(txt_" + list[list.Count - 1].Fieldsname.ToLower() + ".TabIndex);\r\n";
            ___result += "            btn_save.Name = \"btn_save\";\r\n";
            ___result += "            btn_save.Text = \"&SAVE\";\r\n";
            ___result += "            btn_save.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_save.Click += new EventHandler(Btn_save_click);\r\n";
            ___result += "\r\n";
            ___result += "            btn_active.Anchor = XAnchor.RB;\r\n";
            ___result += "            btn_active.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_active.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_active.Location = XLayout.BtnActive;\r\n";
            ___result += "            btn_active.TabIndex = XTab.Index(btn_save.TabIndex);\r\n";
            ___result += "            btn_active.Name = \"btn_active\";\r\n";
            ___result += "            btn_active.Text = \"&Active\";\r\n";
            ___result += "            btn_active.Click += new EventHandler(Btn_active_Click);\r\n";
            ___result += "\r\n";
            ___result += "            txt_notes.TabIndex = btn_active.TabIndex + 1;\r\n";
            ___result += "\r\n";
            ___result += "            #endregion[Properties of btn]\r\n";
            ___result += "\r\n";

            #endregion[Properties of btn]

            ___result += "            #endregion[finner_panel]\r\n";
            ___result += "\r\n";

            #endregion[finner_panel]

            #region [F" + UPPERFIRST + "]

            ___result += "            #region [F" + UPPERFIRST + "]\r\n";
            ___result += "\r\n";
            ___result += "            this.AutoScaleDimensions = new SizeF(6F, 13F);\r\n";
            ___result += "            this.AutoScaleMode = AutoScaleMode.Font;\r\n";
            ___result += "            this.Controls.Add(this.split_container);\r\n";
            ___result += "            this.Name = \"f" + UPPERFIRST + "\";\r\n";
            ___result += "            this.Size = new Size(Screen.PrimaryScreen.Bounds.Width, ClientSize.Height);\r\n";
            ___result += "\r\n";
            ___result += "            this.split_container.Panel1.ResumeLayout(false);\r\n";
            ___result += "            this.split_container.Panel2.ResumeLayout(false);\r\n";
            ___result += "            ((ISupportInitialize)(this.split_container)).EndInit();\r\n";
            ___result += "            this.split_container.ResumeLayout(false);\r\n";
            ___result += "            this.fpanel.ResumeLayout(false);\r\n";
            ___result += "            this.finner_panel.ResumeLayout(false);\r\n";
            ___result += "            this.finner_panel.PerformLayout();\r\n";
            ___result += "            this.ResumeLayout(false);\r\n";
            ___result += "\r\n";
            ___result += "            #endregion [Fpost]\r\n";
            ___result += "        }\r\n";

            #endregion [Fpost]

            #endregion[Initialize]

            #region[result]

            ___result += "}//cls \r\n";
            ___result += "}//ns \r\n";

            return ___result;

            #endregion[result]

        }
コード例 #19
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            //string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            //___result += "using System; \r\n";
            ___result += "using System.Windows.Forms; \r\n";
            ___result += "using System.Collections.Generic; \r\n";
            //___result += "using System.Data; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += " \r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + " \r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class L" + UPPERFIRST + "\r\n";
            ___result += "    { \r\n";

            #endregion [namespace]

            #region [list Option]

            ___result += "        #region[list Option] \r\n ";
            ___result += " \r\n ";
            ___result += "        public void ListRefresh() \r\n ";
            ___result += "        { \r\n ";
            ___result += "            List_Option(fAction); \r\n ";
            ___result += "        } \r\n ";
            ___result += "        \r\n ";
            ___result += "        private ListOption fAction = ListOption.active; \r\n ";
            ___result += "        public void List_Option(ListOption action) \r\n ";
            ___result += "        { \r\n ";
            ___result += "            fAction = action; \r\n ";
            ___result += "            \r\n ";
            ___result += "            switch (fAction) \r\n ";
            ___result += "            { \r\n ";
            ___result += "                case ListOption.active: \r\n ";
            ___result += " \r\n ";
            ___result += "                    if (chk_notactive.Checked == true) \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.NotActive()); \r\n ";
            ___result += "                    } \r\n ";
            ___result += "                    else \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Active()); \r\n ";
            ___result += "                    } \r\n ";
            ___result += " \r\n ";
            ___result += "                    break; \r\n ";
            ___result += " \r\n ";
            ___result += "                case ListOption.notactive: \r\n ";
            ___result += " \r\n ";
            ___result += "                    if (chk_notactive.Checked == true) \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.NotActive()); \r\n ";
            ___result += "                    } \r\n ";
            ___result += "                    else \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Active()); \r\n ";
            ___result += "                    } \r\n ";
            ___result += " \r\n ";
            ___result += "                    break; \r\n ";
            ___result += " \r\n ";
            ___result += "                case ListOption.Search: \r\n ";
            ___result += "                    if (txt_" + SMALL + "_name.Text != \"\") \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                    List<" + UPPERFIRST + "> list = new List<" + UPPERFIRST + "> \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                    C" + UPPERFIRST + "_exten.SearchName(txt_" + SMALL + "_name.Text) \r\n ";
            ___result += "                    }; \r\n ";
            ___result += "                    LoadData(list); \r\n ";
            ___result += "                    } \r\n ";
            ___result += "                    else \r\n ";
            ___result += "                    { \r\n ";
            ___result += "                        LoadData(C" + UPPERFIRST + "_exten.Active()); \r\n ";
            ___result += "                    } \r\n ";
            ___result += "                    break; \r\n ";
            ___result += " \r\n ";
            ___result += "                default: \r\n ";
            ___result += "                    LoadData(C" + UPPERFIRST + "_exten.Active()); \r\n ";
            ___result += "                    break; \r\n ";
            ___result += "            } \r\n ";
            ___result += "        } \r\n ";
            ___result += " \r\n ";
            ___result += "        #endregion[list Option] \r\n ";
            ___result += " \r\n ";

            #endregion [list Option]

            #region [Load Data]

            ___result += "        #region[Load Data] \r\n ";
            ___result += " \r\n ";
            ___result += "        public void LoadData(List<" + UPPERFIRST + "> list) \r\n ";
            ___result += "        { \r\n ";
            ___result += "            listgrid.RowCount = 0; \r\n ";
            ___result += "            listgrid.RowCount = list.Count; \r\n ";
            ___result += "            for (int r = 0; r < list.Count; r++) \r\n ";
            ___result += "            { \r\n ";
            ___result += "                DataGridViewRow row = listgrid.Rows[r]; \r\n ";
            ___result += "                \r\n ";
            ___result += "                row.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value = list[r]." + UPPERFIRST + "_id; \r\n ";

            for (int r = 0; r < list.Count; r++)
            {
                ___result += "                row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = list[r]." + list[r].Fieldsname.UpperFirst() + "; \r\n ";
            }
            ___result += "                row.Cells[" + CAPITAL + ".NOTES].Value = list[r].Notes; \r\n ";
            ___result += "                row.Cells[" + CAPITAL + ".ACTIVE_ID].Value = list[r].Active_id; \r\n ";
            ___result += "                row.Cells[" + CAPITAL + ".USER_ID].Value = list[r].User_id; \r\n ";
            ___result += "            } \r\n ";
            ___result += "        } \r\n ";
            ___result += "        \r\n ";
            ___result += "        #endregion[Load Data] \r\n ";

            #endregion [Load Data]

            #region [finally return]

            ___result += "\r\n ";
            ___result += "}//cls \r\n";
            ___result += "}//ns \r\n";
            return(___result);

            #endregion [Finally return]
        }
コード例 #20
0
        //
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            //string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = ChangeCase.ToUpper(TRIM_TBL);
            string SMALL      = ChangeCase.ToLower(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);

            string ___result = "";

            string xDAL = "DAL";

            //
            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System;\r\n";
            ___result += "using System.Data;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using CXCORE;\r\n";
            ___result += "using System.Collections.Generic;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class C" + UPPERFIRST + "_exten\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Entity Data]

            ___result += "         #region[Entity Data]\r\n";
            ___result += "\r\n";
            ___result += "        private static " + UPPERFIRST + " EntityData(string q)\r\n";
            ___result += "        {\r\n";
            ___result += "            using (IDataReader redr = new " + xDAL + "().Listreader(q))\r\n";
            ___result += "            {\r\n";
            ___result += "                 while (redr.Read() == true)\r\n";
            ___result += "                 {\r\n";
            ___result += "                    " + UPPERFIRST + " obj = new " + UPPERFIRST + "()\r\n";
            ___result += "                    {\r\n";
            ___result += "                        " + UPPERFIRST + "_id = redr[" + CAPITAL + "." + CAPITAL + "_ID].ToString(),\r\n";
            ___result += "                        Uniqueno = redr[" + CAPITAL + ".UNIQUENO].ToString(),\r\n";
            ___result += "                        Company_id = redr[" + CAPITAL + ".COMPANY_ID].ToString(),\r\n";
            ___result += "                        Acy_id = redr[" + CAPITAL + ".ACY_ID].ToString(),\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.FORIEGN:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + "].ToString(),\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;


                default:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                    break;
                }
            }

            ___result += "                        Notes = redr[" + CAPITAL + ".NOTES].ToString(),\r\n";
            ___result += "                        Active_id = redr[" + CAPITAL + ".ACTIVE_ID].ToString(),\r\n";
            ___result += "                        User_id = redr[USER.USER_NAME].ToString()\r\n";
            ___result += "                        };\r\n";
            ___result += "                    return obj;\r\n";
            ___result += "                 }\r\n";
            ___result += "            redr.Close();\r\n";
            ___result += "            return new " + UPPERFIRST + "();\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Entity Data]\r\n";
            ___result += "\r\n";

            #endregion [Entity Data]

            #region [Entity List]

            ___result += "         #region[Entity List]\r\n";
            ___result += "\r\n";
            ___result += "         private static List<" + UPPERFIRST + "> EntityList(string q)\r\n";
            ___result += "         {\r\n";
            ___result += "             List<" + UPPERFIRST + "> list = new List<" + UPPERFIRST + ">();\r\n";
            ___result += "\r\n";
            ___result += "             using (IDataReader redr = new " + xDAL + "().Listreader(q))\r\n";
            ___result += "             {\r\n";
            ___result += "                 while (redr.Read() == true)\r\n";
            ___result += "                 {\r\n";
            ___result += "                      " + UPPERFIRST + " obj = new " + UPPERFIRST + "()\r\n";
            ___result += "                     {\r\n";
            ___result += "                        " + UPPERFIRST + "_id = redr[" + CAPITAL + "." + CAPITAL + "_ID].ToString(),\r\n";
            ___result += "                        Uniqueno = redr[" + CAPITAL + ".UNIQUENO].ToString(),\r\n";
            ___result += "                        Company_id = redr[" + CAPITAL + ".COMPANY_ID].ToString(),\r\n";
            ___result += "                        Acy_id = redr[" + CAPITAL + ".ACY_ID].ToString(),\r\n";
            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.FORIEGN:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + "].ToString(),\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = ConvertTO.Decimal(redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString()),\r\n";
                    break;


                default:
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                    break;
                }
            }
            ___result += "                        Notes = redr[" + CAPITAL + ".NOTES].ToString(),\r\n";
            ___result += "                        Active_id = redr[" + CAPITAL + ".ACTIVE_ID].ToString(),\r\n";
            ___result += "                        User_id = redr[USER.USER_NAME].ToString()\r\n";
            ___result += "                     };\r\n";
            ___result += "\r\n";
            ___result += "                     list.Add(obj);\r\n";
            ___result += "                 }\r\n";
            ___result += "\r\n";
            ___result += "             redr.Close();\r\n";
            ___result += "             }\r\n";
            ___result += "             return list;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Entity List]\r\n";
            ___result += "\r\n";

            #endregion [Entity List]

            #region [Unrefer]

            ___result += "         #region[Unrefer]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Unrefer()\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".LOCKED + \" = '\" + Core.Unlocked + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Unrefer]\r\n";
            ___result += "\r\n";

            #endregion [Unrefer]

            #region [refer]

            ___result += "         #region[refer]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Refer()\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".LOCKED + \" = '\" + Core.Unlocked + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[refer]\r\n";
            ___result += "\r\n";
            #endregion [refer]

            #region [showall]

            ___result += "         #region[showall]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Showall()\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[showall]\r\n";
            ___result += "\r\n";
            #endregion [showall]

            #region [not active]

            ___result += "         #region[not active]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Notactive()\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.NotActive + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[not active]\r\n";
            ___result += "\r\n";
            #endregion [not active]

            #region [PKId]

            ___result += "         #region[PKId]\r\n";
            ___result += "\r\n";
            ___result += "         public static " + UPPERFIRST + " PKId(string id)\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + id + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityData(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[PKId]\r\n";
            ___result += "\r\n";

            #endregion [PKId]

            #region [Searchby]

            ___result += "         #region[Searchby]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Searchby(string no, string date, string dateTo, string party)\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                     + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                    }
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    if (list[r].Fieldsname.ToUpper() != "COMPANY_ID") // OMIT COMPANY
                    {
                        ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \"\\r\\n\";\r\n";
                        ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + list[r].Fieldsname.ToUpper() + " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \" )\\r\\n\";\r\n";
                    }
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";

            ___result += "            if (no != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \" = '\" + no + \"'\\r\\n\";\r\n";
            ___result += "            }\r\n";
            ___result += "            if (dateTo != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_DATE + \"  BETWEEN \" + ConvertTO.SqlDate(date) + \" AND \" + ConvertTO.SqlDate(dateTo) + \"\\r\\n\";\r\n";
            ___result += "            }\r\n";
            ___result += "            else if (date != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "\r\n";
            ___result += "                q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_DATE + \" = \" + ConvertTO.SqlDate(date) + \"\\r\\n\";\r\n";
            ___result += "            }\r\n";
            ___result += "            if (party != \"\")\r\n";
            ___result += "            {\r\n";
            ___result += "                q += \" AND \" + PARTY.PARTY_TBL + \".\" + PARTY.PARTY_NAME + \" = '\" + party + \"'  \\r\\n\";\r\n";
            ___result += "            }\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Searchby]\r\n";
            ___result += "\r\n";

            #endregion [Searchby]

            #region [GetforLookup]

            ___result += "         #region[GetforLookup]\r\n";
            ___result += "\r\n";
            ___result += "        public static DataTable LookupNo()\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = \" SELECT  DISTINCT \\r\\n\";\r\n";
            ___result += "            q += \" \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "            return new DAL().Listdata(q);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        public static DataTable LookupParty()\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = \" SELECT  DISTINCT \\r\\n\";\r\n";
            ___result += "            q += \" \" + PARTY.PARTY_TBL + \".\" + PARTY.PARTY_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";
            ___result += "            q += \" INNER JOIN  \" + PARTY.PARTY_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".PARTY_ID + \" = \" + PARTY.PARTY_TBL + \".\" + PARTY.PARTY_ID + \" )\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "            return new DAL().Listdata(q);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        public static DataTable LookupDate()\r\n";
            ___result += "        {\r\n";
            ___result += "            string q = \" SELECT  DISTINCT \\r\\n\";\r\n";
            ___result += "            q += \" \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_DATE + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" AND \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".COMPANY_ID + \" = '\" + Current.Company_id + \"'  \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NO + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "            DataTable xtbl = new DAL().Listdata(q);\r\n";
            ___result += "\r\n";
            ___result += "            DataTable tbl = new DataTable();\r\n";
            ___result += "\r\n";
            ___result += "            tbl.Columns.Add(" + CAPITAL + "." + CAPITAL + "_DATE, typeof(string));\r\n";
            ___result += "            if (xtbl.Rows.Count != 0)\r\n";
            ___result += "            {\r\n";
            ___result += "                for (int i = 0; i < xtbl.Rows.Count; i++)\r\n";
            ___result += "                {\r\n";
            ___result += "                    tbl.Rows.Add(ConvertTO.Date2S(xtbl.Rows[i][" + CAPITAL + "." + CAPITAL + "_DATE] + \"\")\r\n";
            ___result += "                    );\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "            return tbl;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[GetforLookup]\r\n";
            ___result += "\r\n";

            #endregion [GetforLookup]

            #region [GetNext_No]

            ___result += "        #region[GetNext_No]\r\n";
            ___result += "\r\n";
            ___result += "        public static string GetNext_No\r\n";
            ___result += "        {\r\n";
            ___result += "            get\r\n";
            ___result += "            {\r\n";
            ___result += "                string q = \"SELECT \" + " + CAPITAL + "." + CAPITAL + "_NO + \" FROM \" + " + CAPITAL + "." + CAPITAL + "_TBL + \"\\r\\n\";\r\n";
            ___result += "                q += \" WHERE \" + " + CAPITAL + ".COMPANY_ID + \" = \" + Current.Company_id + \" \\r\\n\";\r\n";
            ___result += "                q += \" ORDER BY \" + " + CAPITAL + "." + CAPITAL + "_NO + \" DESC LIMIT 1;\\r\\n\";\r\n";
            ___result += "                using (IDataReader redr = new DAL().Listreader(q))\r\n";
            ___result += "                {\r\n";
            ___result += "                    while (redr.Read() == true)\r\n";
            ___result += "                    {\r\n";
            ___result += "                        return ((Convert.ToInt32(redr[" + CAPITAL + "." + CAPITAL + "_NO].ToString())) + 1).ToString();\r\n";
            ___result += "                    }\r\n";
            ___result += "                     redr.Close();\r\n";
            ___result += "                    return Core.One;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[GetNext_No]\r\n";
            ___result += "\r\n";

            #endregion [GetforLookup]

            #region [Lock Status]

            ___result += "        #region[Lock Status]\r\n";
            ___result += "\r\n";
            ___result += "        public static bool LockStatus(string pkValue)\r\n";
            ___result += "        {\r\n";
            ___result += "            if (pkValue != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                " + UPPERFIRST + " obj = PKId(pkValue);\r\n";
            ___result += "                if (obj.Locked == Core.Unlocked)\r\n";
            ___result += "                {\r\n";
            ___result += "                    return false;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "            return true;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Lock Status]\r\n";
            ___result += "\r\n";

            #endregion [Lock Status]

            #region [Get id - FieldsName]

            ___result += "        #region[Get id - FieldsName]\r\n";
            ___result += "\r\n ";
            ___result += "        public static string GetName_Id(string _pId)\r\n";
            ___result += "        {\r\n";
            ___result += "            " + UPPERFIRST + " obj = PKId(_pId);\r\n";
            ___result += "\r\n ";
            ___result += "            if (obj != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                return obj." + UPPERFIRST + "_no;\r\n";
            ___result += "            }\r\n";
            ___result += "            return \"\";\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n ";
            ___result += "        public static string GetId_Name(string _pName)\r\n";
            ___result += "        {\r\n";
            ___result += "            var list = Searchby(\"\",\"\",\"\",_pName);\r\n";
            ___result += "\r\n ";
            ___result += "            if (list.Count != 0)\r\n";
            ___result += "            {\r\n";
            ___result += "                return list[0]." + UPPERFIRST + "_id;\r\n";
            ___result += "            }\r\n";
            ___result += "            return \"\";\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n ";
            ___result += "        #endregion[Get id - FieldsName]\r\n";
            ___result += "\r\n";
            #endregion [Get id - FieldsName]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #21
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System; \r\n";
            ___result += "using System.Drawing; \r\n";
            ___result += "using System.Windows.Forms; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += " \r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + " \r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class L" + UPPERFIRST + ": CxControl\r\n";
            ___result += "    { \r\n";

            #endregion [namespace]

            #region []
            ___result += "\r\n";
            ___result += "          private F" + UPPERFIRST + " f" + SMALL + " = null;\r\n";
            ___result += "\r\n";
            ___result += "         public L" + UPPERFIRST + "()\r\n";
            ___result += "         {\r\n";
            ___result += "             InitializeComponent();\r\n";
            ___result += "             Initialize();\r\n";
            ___result += "             InitGrid();\r\n";
            ___result += "              List_Option(ListOption.active);\r\n";

            ___result += "             " + UPPERFIRST + "_lookup();\r\n";

            ___result += "         }\r\n";
            ___result += " \r\n";
            #endregion []

            #region [Private Declare]

            ___result += "        #region[Private Declare] \r\n";
            ___result += " \r\n";
            ___result += "        private XShadowPanel lpanel; \r\n";
            ___result += "        private Panel linner_panel; \r\n";
            ___result += "        private MCheckBox chk_notactive; \r\n";
            ___result += "        private OfficeButton btn_search; \r\n";
            ___result += "        private LookupBox txt_" + SMALL + "_name; \r\n";
            ___result += "        private XLabel lbl_" + SMALL + "_name; \r\n";
            ___result += "        private CloseButton btn_close; \r\n";
            ___result += "        private Header lbl_header; \r\n";
            ___result += "        private OfficeButton btn_print; \r\n";
            ___result += "        private OfficeButton btn_delete; \r\n";
            ___result += "        private OfficeButton btn_edit; \r\n";
            ___result += "        private OfficeButton btn_new; \r\n";
            ___result += "        private OfficeButton btn_refresh; \r\n";
            ___result += "        private ListGridView listgrid; \r\n";
            ___result += " \r\n";
            ___result += "        #endregion[Private Declare] \r\n";
            ___result += " \r\n";
            #endregion [Private Declare]

            ___result += "        #region[Initialize] \r\n";

            ___result += "        private void Initialize() \r\n";
            ___result += "        { \r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); \r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); \r\n";
            ___result += "            DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); \r\n";
            ___result += "            lpanel = new XShadowPanel(); \r\n";
            ___result += "            linner_panel = new Panel(); \r\n";
            ___result += "            chk_notactive = new MCheckBox(); \r\n";
            ___result += "            txt_" + SMALL + "_name = new LookupBox(); \r\n";
            ___result += "            lbl_" + SMALL + "_name = new XLabel(); \r\n";
            ___result += "            btn_close = new CloseButton(); \r\n";
            ___result += "            lbl_header = new Header(); \r\n";
            ___result += "            btn_print = new OfficeButton(); \r\n";
            ___result += "            btn_delete = new OfficeButton(); \r\n";
            ___result += "            btn_edit = new OfficeButton(); \r\n";
            ___result += "            btn_new = new OfficeButton(); \r\n";
            ___result += "            btn_refresh = new OfficeButton(); \r\n";
            ___result += "            listgrid = new ListGridView(); \r\n";
            ___result += "            btn_search = new OfficeButton(); \r\n";
            ___result += "            lpanel.SuspendLayout(); \r\n";
            ___result += "            linner_panel.SuspendLayout(); \r\n";
            ___result += "            ((System.ComponentModel.ISupportInitialize)(listgrid)).BeginInit(); \r\n";
            ___result += "            SuspendLayout(); \r\n";
            ___result += "\r\n";
            ___result += "            lpanel.Name = \"lpanel\"; \r\n";
            ___result += "            lpanel.Dock = DockStyle.Fill; \r\n";
            ___result += "            lpanel.Size = XSize.FPanel; \r\n";
            ___result += "            lpanel.Location =XLayout.FPanel; \r\n";
            ___result += "            lpanel.BackColor = XTheme.FPanel;\r\n";
            ___result += "            lpanel.Controls.Add(linner_panel); \r\n";
            ___result += "            lpanel.Controls.Add(btn_close);\r\n";
            ___result += "            lpanel.Controls.Add(lbl_header);\r\n";
            ___result += "\r\n";
            ___result += "            linner_panel.Anchor = XAnchor.LTRB; \r\n";
            ___result += "            linner_panel.BackColor =  XTheme.LInnerpanel; \r\n";
            ___result += "            linner_panel.Controls.Add(btn_search); \r\n";
            ___result += "            linner_panel.Controls.Add(chk_notactive); \r\n";
            ___result += "            linner_panel.Controls.Add(txt_" + SMALL + "_name); \r\n";
            ___result += "            linner_panel.Controls.Add(lbl_" + SMALL + "_name); \r\n";
            ___result += "            linner_panel.Controls.Add(btn_print); \r\n";
            ___result += "            linner_panel.Controls.Add(btn_delete); \r\n";
            ___result += "            linner_panel.Controls.Add(btn_edit); \r\n";
            ___result += "            linner_panel.Controls.Add(btn_new); \r\n";
            ___result += "            linner_panel.Controls.Add(btn_refresh); \r\n";
            ___result += "            linner_panel.Controls.Add(listgrid); \r\n";
            ___result += "            linner_panel.Location = XLayout.LInnerPanel; \r\n";
            ___result += "            linner_panel.Name = \"linner_panel\"; \r\n";
            ___result += "            linner_panel.Size = XSize.LInnerPanel;\r\n";
            ___result += "\r\n";
            ___result += "            btn_close.Click += Btn_close_Click; \r\n";
            ___result += "\r\n";
            ___result += "            lbl_header.Text = \"" + ((obj.Mastertable.Alias).Replace("_", " ")).UpperFirst() + "\";\r\n";
            ___result += "\r\n";
            ___result += "            chk_notactive.Anchor = XAnchor.TR;\r\n";
            ___result += "            chk_notactive.AutoSize = true; \r\n";
            ___result += "            chk_notactive.Font = XFont.TxtFont;\r\n";
            ___result += "            chk_notactive.Location = XLayout.ListFirstBtn;\r\n";
            ___result += "            chk_notactive.MouseLocation = new Point(-1, -1); \r\n";
            ___result += "            chk_notactive.Name = \"chk_notactive\"; \r\n";
            ___result += "            chk_notactive.Size = new Size(92, 30); \r\n";
            ___result += "            chk_notactive.TabIndex = 4; \r\n";
            ___result += "            chk_notactive.Text = \"Not Active\"; \r\n";
            ___result += "            chk_notactive.CheckedChanged += new System.EventHandler(Chk_notactive_CheckedChanged); \r\n";
            ___result += "\r\n";
            ___result += "            txt_" + SMALL + "_name.Font = XFont.TxtFont; \r\n";
            ___result += "            txt_" + SMALL + "_name.ForeColor = XFontColor.TxtFontColor; \r\n";
            ___result += "            txt_" + SMALL + "_name.BackColor = XTheme.TxtBackcolor; \r\n";
            ___result += "            txt_" + SMALL + "_name.Name = \"txt_" + SMALL + "_name\"; \r\n";
            ___result += "            txt_" + SMALL + "_name.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor; \r\n";
            ___result += "            txt_" + SMALL + "_name.Size = XSize.TwoText; \r\n";
            ___result += "            txt_" + SMALL + "_name.Anchor = XAnchor.LTR; \r\n";
            ___result += "            txt_" + SMALL + "_name.Location = XLayout.FirstText; \r\n";
            ___result += "            txt_" + SMALL + "_name.TabIndex = 5; \r\n";
            ___result += "\r\n";
            ___result += "            lbl_" + SMALL + "_name.Font = XFont.Font_10B; \r\n";
            ___result += "            lbl_" + SMALL + "_name.Name = \"lbl_" + SMALL + "_name\"; \r\n";
            ___result += "            lbl_" + SMALL + "_name.Text = \"" + ((obj.Mastertable.Alias).Replace("_", " ")).UpperFirst() + "\";\r\n";
            ___result += "            lbl_" + SMALL + "_name.TextAlign = ContentAlignment.MiddleCenter; \r\n";
            ___result += "            lbl_" + SMALL + "_name.ForeColor = XFontColor.Lbl_ForeColor; \r\n";
            ___result += "            lbl_" + SMALL + "_name.Size = XSize.OneLabel; \r\n";
            ___result += "            lbl_" + SMALL + "_name.Location = XLayout.FirstLabel; \r\n";
            ___result += "\r\n";
            ___result += "            btn_search.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_search.Location = new Point(txt_" + SMALL + "_name.Right + 10 ,txt_" + SMALL + "_name.Top);\r\n";
            ___result += "            btn_search.Size = new Size(75, 26); \r\n";
            ___result += "            btn_search.TabIndex = 1;\r\n";
            ___result += "            btn_search.Name = \"btn_search\";\r\n";
            ___result += "            btn_search.Text = \"&Search\";\r\n";
            ___result += "            btn_search.Themes = XTheme.YellowBtn;\r\n";
            ___result += "            btn_search.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_search.Click += Btn_search_Click;\r\n";

            ___result += "\r\n";

            ___result += "        #region[btn Properties] \r\n";

            ___result += "\r\n";
            ___result += "            btn_refresh.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_refresh.Location = XLayout.BtnLocation(chk_notactive.Location);\r\n";
            ___result += "            btn_refresh.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_refresh.TabIndex = 1;\r\n";
            ___result += "            btn_refresh.Name = \"btn_refresh\";\r\n";
            ___result += "            btn_refresh.Text = \"&Refresh\";\r\n";
            ___result += "            btn_refresh.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_refresh.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_refresh.Click += Btn_refresh_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_new.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_new.Location = XLayout.BtnLocation(btn_refresh.Location);\r\n";
            ___result += "            btn_new.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_new.TabIndex = XTab.Index(btn_refresh.TabIndex);\r\n";
            ___result += "            btn_new.Name = \"btn_new\";\r\n";
            ___result += "            btn_new.Text = \"&New\";\r\n";
            ___result += "            btn_new.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_new.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_new.Click += Btn_new_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_edit.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_edit.Location = XLayout.BtnLocation(btn_new.Location);\r\n";
            ___result += "            btn_edit.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_edit.TabIndex = XTab.Index(btn_new.TabIndex);\r\n";
            ___result += "            btn_edit.Name = \"btn_edit\";\r\n";
            ___result += "            btn_edit.Text = \"&Edit\";\r\n";
            ___result += "            btn_edit.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_edit.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_edit.Click += Btn_edit_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_delete.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_delete.Location = XLayout.BtnLocation(btn_edit.Location);\r\n";
            ___result += "            btn_delete.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_delete.TabIndex = XTab.Index(btn_edit.TabIndex);\r\n";
            ___result += "            btn_delete.Name = \"btn_delete\";\r\n";
            ___result += "            btn_delete.Text = \"&Delete\";\r\n";
            ___result += "            btn_delete.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_delete.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_delete.Click += Btn_delete_Click;\r\n";
            ___result += "\r\n";
            ___result += "            btn_print.Font = XFont.BtnFont;\r\n";
            ___result += "            btn_print.Location = XLayout.BtnLocation(btn_delete.Location);\r\n";
            ___result += "            btn_print.Size = XSize.BtnOne;\r\n";
            ___result += "            btn_print.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n";
            ___result += "            btn_print.Name = \"btn_print\";\r\n";
            ___result += "            btn_print.Text = \"&Print\";\r\n";
            ___result += "            btn_print.Themes = XTheme.BlueBtn;\r\n";
            ___result += "            btn_print.Anchor = XAnchor.TR;\r\n";
            ___result += "            btn_print.Click += Btn_print_Click;\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[btn Properties] \r\n";

            ___result += "\r\n";
            ___result += "        #region[List Grid] \r\n";
            ___result += "\r\n";

            ___result += "            listgrid.AllowUserToAddRows = false; \r\n";
            ___result += "            listgrid.AllowUserToDeleteRows = false; \r\n";
            ___result += "            listgrid.AllowUserToOrderColumns = true; \r\n";
            ___result += "            listgrid.AllowUserToResizeRows = false; \r\n";
            ___result += "            dataGridViewCellStyle1.BackColor = Color.White; \r\n";
            ___result += "            dataGridViewCellStyle1.Font = XFont.Font_10R; \r\n";
            ___result += "            dataGridViewCellStyle1.ForeColor = Color.Black; \r\n";
            ___result += "            dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(255,255,204); \r\n";
            ___result += "            dataGridViewCellStyle1.SelectionForeColor = Color.FromArgb(252,0,11); \r\n";
            ___result += "            dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True; \r\n";
            ___result += "            listgrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; \r\n";
            ___result += "            listgrid.Anchor = XAnchor.LTRB;\r\n";
            ___result += "            listgrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; \r\n";
            ___result += "            listgrid.BackgroundColor = Color.White; \r\n";
            ___result += "            listgrid.BorderStyle = BorderStyle.Fixed3D; \r\n";
            ___result += "            listgrid.CellBorderStyle = DataGridViewCellBorderStyle.Custom; \r\n";
            ___result += "            listgrid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Custom; \r\n";
            ___result += "            dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter; \r\n";
            ___result += "            dataGridViewCellStyle2.BackColor = Color.FromArgb(132,192,96); \r\n";
            ___result += "            dataGridViewCellStyle2.Font = new Font(\"Microsoft Sans Serif\", 11.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); \r\n";
            ___result += "            dataGridViewCellStyle2.ForeColor = Color.White; \r\n";
            ___result += "            dataGridViewCellStyle2.Padding = new Padding(3); \r\n";
            ___result += "            dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight; \r\n";
            ___result += "            dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText; \r\n";
            ___result += "            dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True; \r\n";
            ___result += "            listgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; \r\n";
            ___result += "            listgrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; \r\n";
            ___result += "            listgrid.Cursor = Cursors.Default; \r\n";
            ___result += "            dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft; \r\n";
            ___result += "            dataGridViewCellStyle3.BackColor = Color.White; \r\n";
            ___result += "            dataGridViewCellStyle3.Font = XFont.Font_10R; \r\n";
            ___result += "            dataGridViewCellStyle3.ForeColor = Color.Black; \r\n";
            ___result += "            dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(255,255,204); \r\n";
            ___result += "            dataGridViewCellStyle3.SelectionForeColor = Color.FromArgb(252,0,11); \r\n";
            ___result += "            dataGridViewCellStyle3.WrapMode = DataGridViewTriState.False; \r\n";
            ___result += "            listgrid.DefaultCellStyle = dataGridViewCellStyle3; \r\n";
            ___result += "            listgrid.EnableHeadersVisualStyles = false; \r\n";
            ___result += "            listgrid.GridColor = Color.SeaGreen; \r\n";
            ___result += "            listgrid.MultiSelect = false; \r\n";
            ___result += "            listgrid.Name = \"listgrid\"; \r\n";
            ___result += "            listgrid.ReadOnly = true; \r\n";
            ___result += "            listgrid.RowHeadersVisible = false; \r\n";
            ___result += "            listgrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; \r\n";
            ___result += "            listgrid.Location = XLayout.ListView; \r\n";
            ___result += "            listgrid.Size = XSize.ListView; \r\n";
            ___result += "            listgrid.StandardTab = true; \r\n";
            ___result += "            listgrid.TabIndex = 0; \r\n";
            ___result += "\r\n";
            ___result += "        #endregion[List Grid] \r\n";
            ___result += "\r\n";

            ___result += "            AutoScaleDimensions = new SizeF(6F, 13F); \r\n";
            ___result += "            AutoScaleMode = AutoScaleMode.Font; \r\n";
            ___result += "            Controls.Add(lpanel); \r\n";
            ___result += "            Name = \"L" + UPPERFIRST + "\"; \r\n";
            ___result += "            Size = new Size(1000, 600); \r\n";
            ___result += "            lpanel.ResumeLayout(false); \r\n";
            ___result += "            linner_panel.ResumeLayout(false); \r\n";
            ___result += "            linner_panel.PerformLayout(); \r\n";
            ___result += "            ((System.ComponentModel.ISupportInitialize)(listgrid)).EndInit(); \r\n";
            ___result += "            ResumeLayout(false); \r\n";
            ___result += " \r\n";
            ___result += "        } \r\n";
            ___result += " \r\n";
            ___result += "        #endregion[Initialize] \r\n";
            ___result += " \r\n";


            #region [result]

            ___result += "    }//cls \r\n";
            ___result += "}//ns \r\n";

            return(___result);

            #endregion [result]
        }
コード例 #22
0
ファイル: SVForm.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List<SFields> list = obj.SFields;
            List<SFieldsItems> sub = obj.SFieldsItems;


            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// " + DateTime.Now + "\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region[using]

            ___result += "using System; \r\n";
            //___result += "using System.ComponentModel; \r\n";
            ___result += "using System.Collections.Generic; \r\n";
            //___result += "using System.Drawing; \r\n";
            ___result += "using System.Windows.Forms; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += "using CXCORE; \r\n";
            ___result += " \r\n";
            ___result += "//  \r\n";

            #endregion[using]

            #region[namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class F" + UPPERFIRST + " : UserControl \r\n";
            ___result += "    { \r\n";

            #endregion[namespace]

            #region[Action]

            ___result += "        #region[Action]\r\n";
            ___result += "\r\n";
            ___result += "        private BtnEvent fAction = BtnEvent.Open;\r\n";
            ___result += "        private " + UPPERFIRST + " obj;\r\n";
            ___result += "        private List<" + UPPERFIRST + "items> list;\r\n";
            ___result += "        private string vId;\r\n";
            ___result += "\r\n";
            ___result += "        public void SetAction(BtnEvent action, string pk)\r\n";
            ___result += "        {\r\n";
            ___result += "            fAction = action;\r\n";
            ___result += "           \r\n";
            ___result += "            switch (fAction)\r\n";
            ___result += "            {\r\n";
            ___result += "                case BtnEvent.Open:\r\n";
            ___result += "                    btn_save.Text = \"&CLOSE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    list = C" + UPPERFIRST + "items_exten.FKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.New:\r\n";
            ___result += "                    btn_save.Text = \"&SAVE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + ".GetNew;\r\n";
            ___result += "                    list = new List<" + UPPERFIRST + "items>();\r\n";
            ___result += "                    this.EnableControls(true);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Edit:\r\n";
            ___result += "                    btn_save.Text = \"&UPDATE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    list = C" + UPPERFIRST + "items_exten.FKId(pk);\r\n";
            ___result += "                    this.EnableControls(true);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Delete:\r\n";
            ___result += "                    btn_save.Text = \"CONFIRM\\r\\n&DELETE\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    list = C" + UPPERFIRST + "items_exten.FKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    break;\r\n";
            ___result += "                case BtnEvent.Print:\r\n";
            ___result += "                    btn_save.Text = \"&PRINT\";\r\n";
            ___result += "                    obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n";
            ___result += "                    list = C" + UPPERFIRST + "items_exten.FKId(pk);\r\n";
            ___result += "                    this.EnableControls(false);\r\n";
            ___result += "                    print_panel.Show();\r\n";
            ___result += "                    break;\r\n";
            ___result += "            }\r\n";
            ___result += "           \r\n";
            ___result += "            LoadData(obj);\r\n";
            ___result += "            Loaditems(list);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Action]\r\n";
            ___result += "\r\n";

            #endregion[Action]

            #region[Load Data]

            ___result += "        #region[Load Data]\r\n";
            ___result += "\r\n";
            ___result += "        private void LoadData(" + UPPERFIRST + " obj)\r\n";
            ___result += "        {\r\n";
            ___result += "            vId = obj." + UPPERFIRST + "_id;\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Text = obj." + list[r].Fieldsname.UpperFirst() + ";\r\n";
                }
            }
            ___result += "            txt_notes.Text = obj.Notes;\r\n";
            ___result += "            Core.Stative = obj.Active_id;\r\n";
            ___result += "            Setactives();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Load Data]\r\n";
            ___result += "\r\n";

            #endregion[Load Data]

            #region[load items]

            ___result += "        #region[load items] \r\n";
            ___result += "\r\n";
            ___result += "        public void Loaditems(List<" + UPPERFIRST + "items> list) \r\n";
            ___result += "        { \r\n";
            ___result += "            editgrid.RowCount = 0; \r\n";
            ___result += "            if(list != null)\r\n";
            ___result += "            { \r\n";
            ___result += "                editgrid.RowCount = list.Count; \r\n";
            ___result += "                for (int r = 0; r < list.Count; r++) \r\n";
            ___result += "                { \r\n";
            ___result += "                    DataGridViewRow row = editgrid.Rows[r]; \r\n";
            ___result += " \r\n";
            ___result += "                    row.Cells[" + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID].Value = (list[r]." + UPPERFIRST + "items_id) + \"\"; \r\n";

            for (int r = 0; r < sub.Count - 2; r++)
            {
                ___result += "                    row.Cells[" + CAPITAL + "ITEMS." + sub[r].Fieldsname.ToUpper() + "].Value = (list[r]." + sub[r].Fieldsname.UpperFirst() + ") + \"\"; \r\n";
            }

            ___result += "                } \r\n";
            ___result += "            } \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        #endregion[load items] \r\n";
            ___result += "\r\n";
            #endregion[load items]

            #region[Enable  Disable Controls]

            ___result += "        #region[Enable  Disable Controls]\r\n";
            ___result += "\r\n";
            ___result += "        private void EnableControls(bool pEnabled)\r\n";
            ___result += "        {\r\n";
            ___result += "            bool pReadOnly = !pEnabled;\r\n";
            ___result += "           \r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Inputtype != InputControls.None)
                {
                    ___result += "            txt_" + list[r].Fieldsname.ToLower() + ".Enabled = !pReadOnly;\r\n";
                }
            }
            ___result += "            txt_notes.Enabled = !pReadOnly;\r\n";
            ___result += "           \r\n";
            ___result += "            btn_active.Enabled = !pReadOnly;\r\n";
            ___result += "           \r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Enable  Disable Controls]\r\n";
            ___result += "\r\n";

            #endregion[Enable  Disable Controls]

            #region[Save Event]

            ___result += "        #region[Save Event]\r\n";
            ___result += "\r\n";
            ___result += "        private DAL dalsession;\r\n";

            ___result += "        private void Save_Event()\r\n";
            ___result += "        {\r\n";
            ___result += "            if (Validation() != false)\r\n";
            ___result += "            {\r\n";
            ___result += "                switch (fAction)\r\n";
            ___result += "                {\r\n";
            ___result += "                                        case BtnEvent.Open: \r\n ";
            ___result += "                                            this.Hide(); \r\n ";
            ___result += "                                            Form_NeedToRefresh(); \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n ";
            ___result += "                                        case BtnEvent.New: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                var vData = CollectData(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                dalsession = new DAL(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Insert(vData, dalsession); \r\n ";
            ___result += "                                                vId = DAL.GetIdentity(dalsession); \r\n ";
            ___result += "                                                var itemsList = Collectitems(vId); \r\n ";
            ___result += "                                                C" + UPPERFIRST + "items.Insert(itemsList, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Saved Successfully.\", \"Save...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Save...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n ";
            ___result += "                                        case BtnEvent.Edit: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                var vData = CollectData(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                dalsession = new DAL(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + "items.Delete(vId, dalsession); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Update(vData, dalsession); \r\n ";
            ___result += "                                                var itemsList = Collectitems(vId); \r\n ";
            ___result += "                                                C" + UPPERFIRST + "items.Insert(itemsList, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Updated Successfully.\", \"Update...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "                                         \r\n ";
            ___result += "                                        case BtnEvent.Delete: \r\n ";
            ___result += "                                            try \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                dalsession = new DAL(); \r\n ";
            ___result += "                                                dalsession.BeginTransaction(); \r\n ";
            ___result += "                                                C" + UPPERFIRST + "items.Delete(vId, dalsession); \r\n ";
            ___result += "                                                C" + UPPERFIRST + ".Delete(vId, dalsession); \r\n ";
            ___result += "                                                dalsession.Commit(); \r\n ";
            ___result += "\r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Record Deleted Successfully.\", \"Delete...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n ";
            ___result += "                                                this.Hide(); \r\n ";
            ___result += "                                                Form_NeedToRefresh(); \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            catch (Exception ex) \r\n ";
            ___result += "                                            { \r\n ";
            ___result += "                                                if (dalsession != null) \r\n ";
            ___result += "                                                { \r\n ";
            ___result += "                                                    dalsession.Rollback(); \r\n ";
            ___result += "                                                } \r\n ";
            ___result += "                                                MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n ";
            ___result += "                                                SetFocus(); \r\n ";
            ___result += "                                                return; \r\n ";
            ___result += "                                            } \r\n ";
            ___result += "                                            break; \r\n ";
            ___result += "\r\n";
            ___result += "                    case BtnEvent.Print:\r\n";
            ___result += "                        this.Hide();\r\n";
            ___result += "                        Form_NeedToRefresh();\r\n";
            ___result += "                        break;\r\n";
            ___result += "                }\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Save Event]\r\n";
            ___result += "\r\n";

            #endregion[Event]

            #region[Collect Data]

            ___result += "        #region[Collect Data]\r\n";
            ___result += "\r\n";
            ___result += "        private " + UPPERFIRST + " CollectData()\r\n";
            ___result += "        {\r\n";
            ___result += "            " + UPPERFIRST + " fobj = new " + UPPERFIRST + "()\r\n";
            ___result += "           {\r\n";
            ___result += "                " + UPPERFIRST + "_id = vId,\r\n";

            for (int r = 0; r < list.Count; r++)
            {

                switch (list[r].Fieldsname.UpperFirst())
                {
                    case "Year_no":

                        #region[find no field]

                        if (CAPITAL == "PO")
                        {
                            ___result += "                Year_no =Current.AYear + \"~\" + Current.Company_id + \"~\" + txt_po_no.Text,\r\n";
                        }
                        else
                        {
                            ___result += "                Year_no =Current.AYear + \"~\" + Current.Company_id + \"~\" + C" + UPPERFIRST + "_exten.GetNext_No,\r\n";
                        }

                        #endregion[find no field]

                        break;
                    case "Company_id":
                        ___result += "                Company_id =Current.Company_id,\r\n";
                        break;
                    case "Refered_no":
                        ___result += "                Refered_no =\"\",\r\n";
                        break;
                    case "Locked":
                        ___result += "                Locked =Core.Unlocked,\r\n";
                        break;

                    default:
                        if (list[r].Inputtype == InputControls.LOOKUPBOX)
                        {
                            ___result += "                " + list[r].Fieldsname.UpperFirst() + " = C" + (list[r].Fieldsname.UpperFirst()).Replace("_id", "") + "_exten.GetId_Name(txt_" + list[r].Fieldsname.ToLower() + ".Text),\r\n";
                        }
                        else
                        {

                            if (list[r].Fieldsname.UpperFirst() == UPPERFIRST + "_no")
                            {
                                if (list[r].Inputtype != InputControls.None)
                                {
                                    ___result += "                " + list[r].Fieldsname.UpperFirst() + " = txt_" + list[r].Fieldsname.ToLower() + ".Text,\r\n";
                                }
                                else
                                {
                                    ___result += "                " + list[r].Fieldsname.UpperFirst() + " = C" + UPPERFIRST + "_exten.GetNext_No,\r\n";
                                }
                            }
                            else
                            {
                                ___result += "                " + list[r].Fieldsname.UpperFirst() + " = txt_" + list[r].Fieldsname.ToLower() + ".Text,\r\n";
                            }
                        }
                        break;
                }
            }

            ___result += "                Active_id = Core.Stative,\r\n";
            ___result += "                Notes = txt_notes.Text,\r\n";
            ___result += "                User_id = Current.User\r\n";
            ___result += "            };\r\n";
            ___result += "            return fobj;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[CollectData]\r\n";
            ___result += "\r\n";

            #endregion[Collect Data]

            #region[Collect items Data]

            ___result += "        #region[Collect items] \r\n";
            ___result += "\r\n";
            ___result += "        private List<" + UPPERFIRST + "items> Collectitems(string vId) \r\n";
            ___result += "        { \r\n";
            ___result += "\r\n";
            ___result += "            List<" + UPPERFIRST + "items> list = new List<" + UPPERFIRST + "items>(); \r\n";
            ___result += "\r\n";
            ___result += "            for (int r = 0; r < editgrid.RowCount; r++) \r\n";
            ___result += "            { \r\n";
            ___result += "\r\n";
            ___result += "                " + UPPERFIRST + "items obj = new " + UPPERFIRST + "items(); \r\n";
            ___result += "\r\n";
            ___result += "                if ( \r\n";
            ___result += "               (editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, r].Value + \"\") == \"\" || \r\n";
            ___result += "                (editgrid[" + CAPITAL + "ITEMS.QTY, r].Value + \"\") == \"\"";
            if (obj.STables.Stables_id != "2")
            {
                ___result += " || \r\n                (editgrid[" + CAPITAL + "ITEMS.PRICE, r].Value + \"\") == \"\" \r\n";
            }
            ___result += "                ) \r\n";
            ___result += "                { \r\n";
            ___result += "                    //==LEAVE IT(the empty row).  \r\n";
            ___result += "                } \r\n";
            ___result += "                else \r\n";
            ___result += "                { \r\n";
            ___result += "                    obj." + UPPERFIRST + "items_id = \"\"; \r\n";
            ___result += "                    obj." + UPPERFIRST + "_id = vId; \r\n";

            for (int r = 0; r < sub.Count; r++)
            {
                if (sub[r].Inputtype == InputControls.Lookupbox)
                {
                    ___result += "                    obj." + sub[r].Fieldsname.UpperFirst() + " = C" + (sub[r].Fieldsname.UpperFirst()).Replace("_id", "") + "_exten.GetId_Name(editgrid[" + CAPITAL + "ITEMS." + sub[r].Fieldsname.ToUpper() + ", r].Value + \"\");\r\n";
                }
                else
                {
                    if (sub[r].Inputtype != InputControls.None)
                    {
                        ___result += "                    obj." + sub[r].Fieldsname.UpperFirst() + " = (editgrid[" + CAPITAL + "ITEMS." + sub[r].Fieldsname.ToUpper() + ", r].Value + \"\"); \r\n";
                    }
                }
            }
            ___result += "                    obj.Refered_qty = \"\"; \r\n";
            ___result += "                    obj.Locked = Core.Unlocked; \r\n";
            ___result += "\r\n";
            ___result += "                    list.Add(obj); \r\n";
            ___result += "                } \r\n";
            ___result += "\r\n";
            ___result += "            } \r\n";
            ___result += "\r\n";
            ___result += "            if (list.Count != 0) \r\n";
            ___result += "            { \r\n";
            ___result += "                return list; \r\n";
            ___result += "            } \r\n";
            ___result += "\r\n";
            ___result += "            return null; \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Collect items] \r\n";
            ___result += "\r\n";

            #endregion[Collect items Data]

            #region[Validation]

            ___result += "        #region[Validation]\r\n";
            ___result += "\r\n";
            ___result += "        private bool Validation()\r\n";
            ___result += "        {\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Validate == AutoCode.YES)
                {
                    ___result += "            if (txt_" + list[r].Fieldsname.ToLower() + ".Text.Trim().Length == 0)\r\n";
                    ___result += "            {\r\n";
                    ___result += "                MessageBox.Show(this.FindForm(), \"" + (list[r].Fieldsname.UpperFirst()).Replace("_", " ") + " should not Empty ! \", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n";
                    ___result += "                txt_" + list[r].Fieldsname.ToLower() + ".Focus();\r\n";
                    ___result += "                return false;\r\n";
                    ___result += "            }\r\n";
                    ___result += "           \r\n";
                }
            }

            ___result += "            if (Core.Stative == Core.Idle)\r\n";
            ___result += "            {\r\n";
            ___result += "                MessageBox.Show(this.FindForm(), \"Select Active or not !\", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n";
            ___result += "                btn_active.Focus();\r\n";
            ___result += "                return false;\r\n";
            ___result += "            }\r\n";
            ___result += "           \r\n";
            ___result += "            return true;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Validation]\r\n";
            ___result += "\r\n";

            #endregion[Validation]

            #region[result]

            ___result += "}//cls \r\n";
            ___result += "}//ns \r\n";

            return ___result;

            #endregion[result]

        }
コード例 #23
0
        private static string XCreate(BillTable obj)
        {
            List <SFieldsItems> list = obj.SFieldsItems;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            //string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System.Collections.Generic;\r\n";
            //___result += "using System.Data;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class C" + UPPERFIRST + "items \r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Get New]

            ___result += "\r\n";
            ___result += "        #region[Get New]\r\n";
            ___result += "\r\n";
            ___result += "        public static List<" + UPPERFIRST + "items> GetNew\r\n";
            ___result += "        {\r\n";
            ___result += "            get\r\n";
            ___result += "            {\r\n";
            ___result += "            List<" + UPPERFIRST + "items> list = new List<" + UPPERFIRST + "items>();\r\n";
            ___result += "\r\n";
            ___result += "                " + UPPERFIRST + "items obj = new " + UPPERFIRST + "items()\r\n";
            ___result += "                {\r\n";
            ___result += "                    " + UPPERFIRST + "items_id = string.Empty,\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                switch (list[r].Datatype)

                {
                //case DATATYPES.VARCHAR_500:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_300:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_200:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.VARCHAR_100:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.UNIQUE_500:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.INT:
                //    ___result += "        public int " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.FORIEGN:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;


                //case DATATYPES.DATE:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.DATETIME:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                //case DATATYPES.ENUM_Y_N:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;
                //case DATATYPES.SMALLINT:
                //    ___result += "        public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n";
                //    break;

                case DATATYPES.BOOLX:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " =  false,\r\n";
                    break;

                case DATATYPES.FALSEX:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " =  false,\r\n";
                    break;

                case DATATYPES.TRUEX:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " =  false,\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " =  decimal.Zero,\r\n";
                    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " =  decimal.Zero,\r\n";
                    break;

                case DATATYPES.DOUBLE:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = 0,\r\n";
                    break;


                default:
                    ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = string.Empty,\r\n";
                    break;
                }
            }
            ___result += "                };\r\n";
            ___result += "                list.Add(obj);\r\n";
            ___result += "                return list;\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Get New]\r\n";
            ___result += "\r\n";

            #endregion [Get New]

            #region [Attach params ]

            ___result += "        #region[Attach params]\r\n";
            ___result += "        \r\n";
            ___result += "        private static string AttachParams(string q, " + UPPERFIRST + "items v)\r\n";
            ___result += "        {\r\n";
            //___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID + \"@\", \"\" + ConvertTO.SqlString(v." + UPPERFIRST + "items_id) + \"\");\r\n";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                switch (list[r].Datatype)
                {
                case DATATYPES.DATE:
                    ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDate(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
                    break;

                case DATATYPES.DATETIME:
                    ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDateTime(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
                    break;

                //case DATATYPES.INT:
                //    sqlstr = "SqlInt";
                //    break;

                case DATATYPES.DECMIAL_2:
                    ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDecimal(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
                    break;

                case DATATYPES.DECMIAL_3:
                    ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDecimal(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
                    break;

                default:
                    ___result += "            q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlString(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n";
                    break;
                }
            }
            ___result += "            return q;\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Attach params]\r\n";
            ___result += "        \r\n";

            #endregion [Attach params ]

            #region [Insert]

            ___result += "        #region[Insert]\r\n";
            ___result += "        \r\n";
            ___result += "        public static void Insert(List<" + UPPERFIRST + "items> list, " + xDAL + " dalsession)\r\n";
            ___result += "        {\r\n";
            ___result += "            for (int i = 0; i < list.Count; i++)\r\n";
            ___result += "            {\r\n";
            ___result += "                " + UPPERFIRST + "items obj = new " + UPPERFIRST + "items()\r\n";
            ___result += "                {\r\n";
            //___result += "                " + UPPERFIRST + "items_id = list[i]." + UPPERFIRST + "items_id,\r\n";

            for (int r = 0; r < list.Count - 1; r++)
            {
                ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = list[i]." + list[r].Fieldsname.UpperFirst() + ",\r\n";
            }
            //remove , from last line
            for (int r = list.Count - 1; r < list.Count; r++)
            {
                ___result += "                    " + list[r].Fieldsname.UpperFirst() + " = list[i]." + list[r].Fieldsname.UpperFirst() + "\r\n";
            }

            ___result += "                };\r\n";
            ___result += "                InsertSub(obj, dalsession);\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Insert]\r\n";
            ___result += "\r\n";

            #endregion [Insert]

            #region [Insert Sub]

            ___result += "        #region[InsertSub]\r\n";
            ___result += "        \r\n";
            ___result += "        public static void InsertSub(" + UPPERFIRST + "items v, " + xDAL + " dalsession)\r\n";
            ___result += "        {\r\n";
            ___result += "                string q = \" INSERT INTO \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \" ( \";\r\n";

            ___result += "                q += \" \" + " + CAPITAL + "ITEMS." + list[0].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n";
            for (int r = 1; r < list.Count; r++)
            {
                ___result += "                q += \",\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n";
            }
            ___result += "                q += \" ) VALUES ( \";\r\n";
            ___result += "                q += \"  @\"+ " + CAPITAL + "ITEMS." + list[0].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";

            for (int r = 1; r < list.Count; r++)
            {
                ___result += "                q += \", @\"+ " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n";
            }
            ___result += "                q += \" ) \\r\\n \";\r\n";
            ___result += "                q = AttachParams(q, v);\r\n";
            ___result += "                dalsession.Execute(q);\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Insert]\r\n";
            ___result += "        \r\n";

            #endregion [InsertSub]

            #region [Build delete query]

            ___result += "        #region[Delete]\r\n";
            ___result += "        \r\n";
            ___result += "        public static void Delete(string fkid , " + xDAL + " dalsession)\r\n";;
            ___result += "        {\r\n";
            ___result += "                dalsession.Execute(\"DELETE FROM  \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL+ \" WHERE \" + " + CAPITAL + "ITEMS." + CAPITAL + "_ID + \" =  \" + fkid +\";\");\r\n";
            ___result += "        }\r\n";
            ___result += "        #endregion[Delete]\r\n";
            ___result += "        \r\n";

            #endregion [delete query]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #24
0
        //
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = ChangeCase.ToUpper(TRIM_TBL);
            string SMALL      = ChangeCase.ToLower(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);

            string ___result = "";

            string xDAL = "DAL";

            //
            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System.Data;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using System.Collections.Generic;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public class C" + UPPERFIRST + "_exten\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Entity Data]

            ___result += "         #region[Entity Data]\r\n";
            ___result += "\r\n";
            ___result += "        private static " + UPPERFIRST + " EntityData(string q)\r\n";
            ___result += "        {\r\n";
            ___result += "            using (IDataReader redr = new " + xDAL + "().Listreader(q))\r\n";
            ___result += "            {\r\n";
            ___result += "                 while (redr.Read() == true)\r\n";
            ___result += "                 {\r\n";
            ___result += "                    " + UPPERFIRST + " obj = new " + UPPERFIRST + "()\r\n";
            ___result += "                    {\r\n";
            ___result += "                        " + UPPERFIRST + "_id = redr[" + CAPITAL + "." + CAPITAL + "_ID].ToString(),\r\n";

            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + "].ToString(),\r\n";
                }
                else
                {
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                }
            }

            ___result += "                        Notes = redr[" + CAPITAL + ".NOTES].ToString(),\r\n";
            ___result += "                        Active_id = redr[" + CAPITAL + ".ACTIVE_ID].ToString(),\r\n";
            ___result += "                        User_id = redr[USER.USER_NAME].ToString()\r\n";
            ___result += "                        };\r\n";
            ___result += "                    return obj;\r\n";
            ___result += "                 }\r\n";
            ___result += "            redr.Close();\r\n";
            ___result += "            return new " + UPPERFIRST + "();\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        #endregion[Entity Data]\r\n";
            ___result += "\r\n";

            #endregion [Entity Data]

            #region [Entity List]

            ___result += "         #region[Entity List]\r\n";
            ___result += "\r\n";
            ___result += "         private static List<" + UPPERFIRST + "> EntityList(string q)\r\n";
            ___result += "         {\r\n";
            ___result += "             List<" + UPPERFIRST + "> list = new List<" + UPPERFIRST + ">();\r\n";
            ___result += "\r\n";
            ___result += "             using (IDataReader redr = new " + xDAL + "().Listreader(q))\r\n";
            ___result += "             {\r\n";
            ___result += "                 while (redr.Read() == true)\r\n";
            ___result += "                 {\r\n";
            ___result += "                      " + UPPERFIRST + " obj = new " + UPPERFIRST + "()\r\n";
            ___result += "                     {\r\n";
            ___result += "                        " + UPPERFIRST + "_id = redr[" + CAPITAL + "." + CAPITAL + "_ID].ToString(),\r\n";
            for (int r = 0; r <= list.Count - 1; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + "].ToString(),\r\n";
                }
                else
                {
                    ___result += "                        " + list[r].Fieldsname.UpperFirst() + " = redr[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].ToString(),\r\n";
                }
            }
            ___result += "                        Notes = redr[" + CAPITAL + ".NOTES].ToString(),\r\n";
            ___result += "                        Active_id = redr[" + CAPITAL + ".ACTIVE_ID].ToString(),\r\n";
            ___result += "                        User_id = redr[USER.USER_NAME].ToString()\r\n";
            ___result += "                     };\r\n";
            ___result += "\r\n";
            ___result += "                     list.Add(obj);\r\n";
            ___result += "                 }\r\n";
            ___result += "\r\n";
            ___result += "             redr.Close();\r\n";
            ___result += "             }\r\n";
            ___result += "             return list;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Entity List]\r\n";
            ___result += "\r\n";

            #endregion [Entity List]

            #region [Active]

            ___result += "         #region[Active]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> Active()\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                 + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                }
            }

            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \" \\r\\n\";\r\n";
                    ___result += "            q += \" ON( \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper();
                    ___result += " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + "+ \".\" +" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \")\\r\\n\";\r\n";
                }
            }

            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            //q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NAME + \";\\r\\n\";\r\n";
            ___result += "\r\n";

            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Active]\r\n";
            ___result += "\r\n";
            #endregion [Active]

            #region [Not Active]

            ___result += "         #region[NotActive]\r\n";
            ___result += "\r\n";
            ___result += "         public static List<" + UPPERFIRST + "> NotActive()\r\n";
            ___result += "         {\r\n";
            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                 + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                }
            }
            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \" \\r\\n\";\r\n";
                    ___result += "            q += \" ON( \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper();
                    ___result += " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + "+ \".\" +" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \")\\r\\n\";\r\n";
                }
            }

            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.NotActive + \"' \\r\\n\";\r\n";
            ___result += "            //q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NAME + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityList(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[NotActive]\r\n";
            ___result += "\r\n";

            #endregion [Check Box]

            #region [Primary Key]

            ___result += "         #region[Primary Key]\r\n";
            ___result += "\r\n";
            ___result += "         public static " + UPPERFIRST + " PKId(string v)\r\n";
            ___result += "         {\r\n";
            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                 + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                }
            }
            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \" \\r\\n\";\r\n";
                    ___result += "            q += \" ON( \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper();
                    ___result += " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + "+ \".\" +" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \")\\r\\n\";\r\n";
                }
            }

            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \"  = '\" + v + \"' \\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityData(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Primary Key]\r\n";
            ___result += "\r\n";

            #endregion [Primary Key]

            #region [Search by name]

            ___result += "         #region[Search by name]\r\n";
            ___result += "\r\n";
            ___result += "         public static " + UPPERFIRST + " SearchName(string v)\r\n";
            ___result += "         {\r\n";

            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                 + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                }
            }
            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \" \\r\\n\";\r\n";
                    ___result += "            q += \" ON( \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper();
                    ___result += " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + "+ \".\" +" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \")\\r\\n\";\r\n";
                }
            }

            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NAME + \"  = '\" + v + \"' \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NAME + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return EntityData(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Search by name]\r\n";
            ___result += "\r\n";

            #endregion [Search by name]

            #region [Look up]

            ___result += "         #region[Look up]\r\n";
            ___result += "\r\n";
            ___result += "         public static DataTable GetforLookup()\r\n";
            ___result += "         {\r\n";
            ___result += "            string q = \" SELECT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".* \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \", \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL")

                                 + " + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_NAME") + " + \" \\r\\n\";\r\n";
                }
            }
            ___result += "            q += \", \" + USER.USER_TBL + \".\" + USER.USER_NAME + \" \\r\\n\";\r\n";
            ___result += "            q += \" FROM  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \" \\r\\n\";\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                if (list[r].Datatype == DATATYPES.FORIEGN)
                {
                    ___result += "            q += \" INNER JOIN  \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + " + \" \\r\\n\";\r\n";
                    ___result += "            q += \" ON( \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper();
                    ___result += " + \" = \" + " + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + (list[r].Fieldsname.ToUpper()).Replace("_ID", "_TBL") + "+ \".\" +" + (list[r].Fieldsname.ToUpper()).Replace("_ID", "") + "." + list[r].Fieldsname.ToUpper() + " + \")\\r\\n\";\r\n";
                }
            }
            ___result += "            q += \" INNER JOIN  \" + USER.USER_TBL + \"\\r\\n\";\r\n";
            ___result += "            q += \" ON(\" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + USER.USER_ID + \"  = \" + USER.USER_TBL + \".\" + USER.USER_ID + \")\\r\\n\";\r\n";
            ___result += "            q += \" WHERE \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + ".ACTIVE_ID + \"  = '\" + Core.Active + \"' \\r\\n\";\r\n";
            ___result += "            //q += \" AND NOT \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_ID + \" = '\" + Core.One + \"' \\r\\n\";\r\n";
            ___result += "            q += \" ORDER BY  \" + " + CAPITAL + "." + CAPITAL + "_TBL + \".\" + " + CAPITAL + "." + CAPITAL + "_NAME + \";\\r\\n\";\r\n";
            ___result += "\r\n";
            ___result += "             return new " + xDAL + "().Listdata(q);\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Look up]\r\n";
            ___result += "\r\n";

            #endregion [Look up]

            #region [Get id - Name]

            ___result += "        #region[Get id - Name]\r\n";
            ___result += "\r\n ";
            ___result += "        public static string GetName_Id(string v)\r\n";
            ___result += "        {\r\n";
            ___result += "            " + UPPERFIRST + " obj = PKId(v);\r\n";
            ___result += "\r\n ";
            ___result += "            if (obj != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                return obj." + UPPERFIRST + "_name;\r\n";
            ___result += "            }\r\n";
            ___result += "            return \"\";\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n ";
            ___result += "        public static string GetId_Name(string v)\r\n";
            ___result += "        {\r\n";
            ___result += "            " + UPPERFIRST + " obj = SearchName(v);\r\n";
            ___result += "\r\n ";
            ___result += "            if (obj != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                return obj." + UPPERFIRST + "_id;\r\n";
            ___result += "            }\r\n";
            ___result += "            return \"\";\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n ";
            ___result += "        #endregion[Get id - Name]\r\n";
            ___result += "\r\n";
            #endregion [Get id - Name]

            #region [result]
            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [result]
        }
コード例 #25
0
ファイル: SList.cs プロジェクト: CODEXSUN/codexdotnet
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System;\r\n";
            //___result += "using System.Drawing;\r\n";
            ___result += "using System.Windows.Forms;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using CXCORE;\r\n";
            ___result += "\r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "{\r\n";
            ___result += "    public partial class L" + UPPERFIRST + " : CxControl\r\n";
            ___result += "    {\r\n";

            #endregion [namespace]

            #region [Grid Action]

            ___result += "            #region[Grid Action]\r\n";
            ___result += "\r\n";
            ___result += "            void Listgrid_RowAction(object sender, EventArgs e)\r\n";
            ___result += "            {\r\n";
            ___result += "             if (listgrid.SelectedRow == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 return;\r\n";
            ___result += "             }\r\n";
            ___result += "             if (f" + SMALL + " == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + " = new F" + UPPERFIRST + "();\r\n";
            ___result += "             }\r\n";
            ___result += "             BuildForm();\r\n";
            ___result += "             string pkValue = GetSelectedPkValue();\r\n";
            ___result += "             if (pkValue != null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + ".SetAction(BtnEvent.Open, pkValue);\r\n";
            ___result += "             }\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Grid Action]\r\n";
            ___result += "\r\n";

            #endregion [Grid Action]

            #region [Build Form]

            ___result += "         #region[Build Form]\r\n";
            ___result += "\r\n";
            ___result += "         private void BuildForm()\r\n";
            ___result += "         {\r\n";
            ___result += "             if (f" + SMALL + " == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + " = new F" + UPPERFIRST + "();\r\n";
            ___result += "             }\r\n";
            ___result += "             f" + SMALL + ".F" + UPPERFIRST + "_NeedToRefresh += V" + UPPERFIRST + "_NeedToRefresh;\r\n";
            ___result += "             Parent.Controls.Add(f" + SMALL + ");\r\n";
            ___result += "             f" + SMALL + ".Dock = DockStyle.Fill;\r\n";
            ___result += "             f" + SMALL + ".Show();\r\n";
            ___result += "             f" + SMALL + ".BringToFront();\r\n";
            ___result += "\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Build Form]\r\n";
            ___result += "\r\n";

            #endregion [Build Form]

            #region [Radio btn event]

            ___result += "       #region[Radio btn event]\r\n";
            ___result += "\r\n";
            ___result += "       private void Rdo_unrefer_CheckedChanged(object sender, EventArgs e)\r\n";
            ___result += "       {\r\n";
            ___result += "            if (rdo_unrefer.Checked == true)\r\n";
            ___result += "            {\r\n";
            ___result += "                List_Option(ListOption.unrefer);\r\n";
            ___result += "            }\r\n";
            ___result += "       }\r\n";
            ___result += "\r\n";
            ___result += "       private void Rdo_refer_CheckedChanged(object sender, EventArgs e)\r\n";
            ___result += "       {\r\n";
            ___result += "            if (rdo_refer.Checked == true)\r\n";
            ___result += "            {\r\n";
            ___result += "                List_Option(ListOption.refer);\r\n";
            ___result += "            }\r\n";
            ___result += "       }\r\n";
            ___result += "\r\n";
            ___result += "       private void Rdo_showall_CheckedChanged(object sender, EventArgs e)\r\n";
            ___result += "       {\r\n";
            ___result += "            if (rdo_showall.Checked == true)\r\n";
            ___result += "            {\r\n";
            ___result += "                List_Option(ListOption.showall);\r\n";
            ___result += "            }\r\n";
            ___result += "       }\r\n";
            ___result += "\r\n";
            ___result += "       private void Rdo_notactive_CheckedChanged(object sender, EventArgs e)\r\n";
            ___result += "       {\r\n";
            ___result += "            if (rdo_notactive.Checked == true)\r\n";
            ___result += "            {\r\n";
            ___result += "                List_Option(ListOption.notactive);\r\n";
            ___result += "            }\r\n";
            ___result += "       }\r\n";
            ___result += "\r\n";
            ___result += "       #endregion[Radio btn event]\r\n";
            ___result += "\r\n";
            #endregion [Radio btn event]

            #region [Btn Event]

            ___result += "         #region[Btn Event]\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_refresh_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(ListOption.active);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_new_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            BuildForm();\r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.New, null);\r\n";
            ___result += "                f" + SMALL + ".SetFocus();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_edit_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            string pkValue = GetSelectedPkValue();\r\n";
            //___result += "            if (CPo_exten.LockStatus(pkValue) == false)\r\n";
            //___result += "            {\r\n";
            ___result += "                BuildForm();\r\n";
            ___result += "                if (pkValue != null)\r\n";
            ___result += "                {\r\n";
            ___result += "                    f" + SMALL + ".SetAction(BtnEvent.Edit, pkValue);\r\n";
            ___result += "                    f" + SMALL + ".SetFocus();\r\n";
            ___result += "                }\r\n";
            //___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_delete_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            string pkValue = GetSelectedPkValue();\r\n";
            //___result += "            if (CPo_exten.LockStatus(pkValue) == false)\r\n";
            //___result += "            {\r\n";
            ___result += "                BuildForm();\r\n";
            ___result += "                if (pkValue != null)\r\n";
            ___result += "                {\r\n";
            ___result += "                    f" + SMALL + ".SetAction(BtnEvent.Delete, pkValue);\r\n";
            ___result += "                    f" + SMALL + ".SetFocus();\r\n";
            ___result += "                }\r\n";
            //___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_print_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            BuildForm();\r\n";
            ___result += "            string pkValue = GetSelectedPkValue();\r\n";
            ___result += "            if (pkValue != null)\r\n";
            ___result += "            {\r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.Print, pkValue);\r\n";
            ___result += "                f" + SMALL + ".SetFocus();\r\n";
            ___result += "            }\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_close_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            Hide();\r\n";
            ___result += "            RaiseEvent_NeedToRefresh();\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_search_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(ListOption.Search);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Btn Event]\r\n";
            ___result += "\r\n";

            #endregion [Btn Event]

            #region [text change event]

            ___result += "         #region[text change event]\r\n";
            ___result += "\r\n";
            ___result += "        private void Txt_datePicker_TextChanged(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            txt_date.Text = txt_datePicker.Text;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Txt_TodatePicker_TextChanged(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            txt_Todate.Text = txt_TodatePicker.Text;\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[text change event]\r\n";
            ___result += "\r\n";

            #endregion [text change event]

            #region [Enter Event]
            ___result += "         #region[Enter Event]\r\n";
            ___result += "\r\n";
            ___result += "         private void Txt_no_Enter(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             Change_infocus();\r\n";
            ___result += "             lbl_no.BackColor = XTheme.lbl_EnterBackColor;\r\n";
            ___result += "             lbl_no.BorderColor = XTheme.lbl_EnterBorderColor;\r\n";
            ___result += "             lbl_no.ForeColor = XTheme.lbl_EnterForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         private void Txt_date_Enter(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             lbl_date.BackColor = XTheme.lbl_EnterBackColor;\r\n";
            ___result += "             lbl_date.BorderColor = XTheme.lbl_EnterBorderColor;\r\n";
            ___result += "             lbl_date.ForeColor = XTheme.lbl_EnterForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         private void Txt_party_Enter(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             lbl_party.BackColor = XTheme.lbl_EnterBackColor;\r\n";
            ___result += "             lbl_party.BorderColor = XTheme.lbl_EnterBorderColor;\r\n";
            ___result += "             lbl_party.ForeColor = XTheme.lbl_EnterForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         private void Change_infocus()\r\n";
            ___result += "         {\r\n";
            ___result += "\r\n";
            ___result += "             lbl_no.BackColor = XTheme.lbl_BackColor;\r\n";
            ___result += "             lbl_no.BorderColor = XTheme.lbl_BorderColor;\r\n";
            ___result += "             lbl_no.ForeColor = XTheme.lbl_ForeColor;\r\n";
            ___result += "\r\n";
            ___result += "             lbl_date.BackColor = XTheme.lbl_BackColor;\r\n";
            ___result += "             lbl_date.BorderColor = XTheme.lbl_BorderColor;\r\n";
            ___result += "             lbl_date.ForeColor = XTheme.lbl_ForeColor;\r\n";
            ___result += "\r\n";
            ___result += "             lbl_party.BackColor = XTheme.lbl_BackColor;\r\n";
            ___result += "             lbl_party.BorderColor = XTheme.lbl_BorderColor;\r\n";
            ___result += "             lbl_party.ForeColor = XTheme.lbl_ForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Enter Event]\r\n";
            ___result += "\r\n";

            #endregion [Enter Event]

            #region [lookup]

            ___result += "         #region[No lookup]\r\n";
            ___result += "\r\n";
            ___result += "         public void No_lookup()\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_no.LookupColNames = new string[] { " + CAPITAL + "." + CAPITAL + "_NO };\r\n";
            ___result += "             txt_no.LookupUpdate += Txt_no_LookupUpdate;\r\n";
            ___result += "         }\r\n";
            ___result += "         void Txt_no_LookupUpdate(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_no.LookupList = C" + UPPERFIRST + "_exten.LookupNo();\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[No lookup]\r\n";
            ___result += "\r\n";
            ___result += "         #region[Party lookup]\r\n";
            ___result += "\r\n";
            ___result += "         public void Party_lookup()\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_party.LookupColNames = new string[] { PARTY.PARTY_NAME };\r\n";
            ___result += "             txt_party.LookupUpdate += Txt_party_LookupUpdate;\r\n";
            ___result += "         }\r\n";
            ___result += "         void Txt_party_LookupUpdate(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_party.LookupList = CParty_exten.GetforLookup(new DAL());\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Party lookup]\r\n";
            ___result += "\r\n";

            #endregion [lookup]

            #region [Get selected pk value]

            ___result += "         #region[Get selected pk value]\r\n";
            ___result += "\r\n";
            ___result += "         private string GetSelectedPkValue()\r\n";
            ___result += "         {\r\n";
            ___result += "             DataGridViewRow vSelRow = null;\r\n";
            ___result += "             if (listgrid.SelectedRows != null && listgrid.SelectedRows.Count != 0)\r\n";
            ___result += "             {\r\n";
            ___result += "                 vSelRow = listgrid.SelectedRows[0];\r\n";
            ___result += "             }\r\n";
            ___result += "\r\n";
            ___result += "             string selPkValue = null;\r\n";
            ___result += "             if (vSelRow != null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 selPkValue = vSelRow.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value.ToString();\r\n";
            ___result += "             }\r\n";
            ___result += "             return selPkValue;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Get selected pk value]\r\n";
            ___result += "\r\n";

            #endregion [Get selected pk value]

            #region [RaiseEvent]

            ___result += "         #region[RaiseEvent]\r\n";
            ___result += "\r\n";
            ___result += "         void V" + UPPERFIRST + "_NeedToRefresh(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             List_Option(ListOption.active);\r\n";
            ___result += "         }\r\n";

            //___result += "         public event EventHandler L" + UPPERFIRST + "_NeedToRefresh;\r\n";
            //___result += "         public void RaiseEvent_NeedToRefresh()\r\n";
            //___result += "         {\r\n";
            //___result += "             L" + UPPERFIRST + "_NeedToRefresh?.Invoke(this, new EventArgs());\r\n";
            //___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[RaiseEvent]\r\n";
            ___result += "\r\n";

            #endregion [RaiseEvent]

            #region [finally return]

            ___result += "    }//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [Finally return]
        }
コード例 #26
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

            string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4);

            string CAPITAL    = cCultureInfo.toUpperCase(TRIM_TBL);
            string SMALL      = cCultureInfo.toLowerCase(TRIM_TBL);
            string UPPERFIRST = ChangeCase.UpperFirst(SMALL);
            string ___result  = "";

            //string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

            ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n";
            ___result += "// Auto Generated\r\n";
            ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n";
            ___result += "\r\n";

            #endregion [Conclusion]

            #region [using]

            ___result += "using System; \r\n";
            ___result += "using System.Drawing; \r\n";
            ___result += "using System.Windows.Forms; \r\n";
            ___result += "using CXLIB; \r\n";
            ___result += " \r\n";

            #endregion [using]

            #region [namespace]

            ___result += "namespace " + vnamespaces + " \r\n";
            ___result += "{ \r\n";
            ___result += "    public partial class L" + UPPERFIRST + "\r\n";
            ___result += "    { \r\n";

            #endregion [namespace]

            #region [Init Grid ]

            ___result += "\r\n";
            ___result += "         #region[Init Grid]\r\n";
            ___result += "\r\n";
            ___result += "         private void InitGrid()\r\n";
            ___result += "         {\r\n";
            ___result += "            listgrid.RowAction += Listgrid_RowAction;\r\n";
            ___result += "\r\n";

            ___result += "            DataGridViewTextBoxColumn col_" + UPPERFIRST + "_Id = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Name = " + CAPITAL + "." + CAPITAL + "_ID;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.HeaderText = \"" + CAPITAL + "_ID \";\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Visible = false; \r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.Width = 100;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_" + UPPERFIRST + "_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_" + UPPERFIRST + "_Id );\r\n";
            ___result += "\r\n";

            for (int r = 0; r < list.Count; r++)
            {
                string field = (list[r].Fieldsname.ToLower()).UpperFirst();

                ___result += "            DataGridViewTextBoxColumn col_" + field + " = new DataGridViewTextBoxColumn();\r\n";
                ___result += "            col_" + field + ".Name = " + CAPITAL + "." + list[r].Fieldsname + ";\r\n";
                ___result += "            col_" + field + ".HeaderText = \"" + list[r].Displayname.Replace("_", " ") + "\";\r\n";
                ___result += "            //col_" + field + ".Visible = false; \r\n";
                ___result += "            col_" + field + ".Width = " + Find.TxtLength_Point(list[r].Displayname) + ";\r\n";
                ___result += "            col_" + field + ".DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
                ___result += "            col_" + field + ".AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
                ___result += "            listgrid.Columns.Add(col_" + field + ");\r\n";
                ___result += "\r\n";
            }

            ___result += "            DataGridViewTextBoxColumn col_Notes = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_Notes.Name = " + CAPITAL + ".NOTES;\r\n";
            ___result += "            col_Notes.HeaderText = \"NOTES\";\r\n";
            ___result += "            col_Notes.Visible = false; \r\n";
            ___result += "            col_Notes.Width = 200;\r\n";
            ___result += "            col_Notes.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_Notes.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_Notes );\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn col_Active_Id = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_Active_Id.Name = " + CAPITAL + ".ACTIVE_ID;\r\n";
            ___result += "            col_Active_Id.HeaderText = \"ACTIVE ID\";\r\n";
            ___result += "            col_Active_Id.Visible = false; \r\n";
            ___result += "            col_Active_Id.Width = 200;\r\n";
            ___result += "            col_Active_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_Active_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_Active_Id );\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn col_User_Id = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            col_User_Id.Name = " + CAPITAL + ".USER_ID;\r\n";
            ___result += "            col_User_Id.HeaderText = \"ENTRY BY\";\r\n";
            ___result += "            //col_User_Id.Visible = false; \r\n";
            ___result += "            col_User_Id.Width = 120;\r\n";
            ___result += "            col_User_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n";
            ___result += "            col_User_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n";
            ___result += "            listgrid.Columns.Add(col_User_Id );\r\n";
            ___result += "\r\n";
            ___result += "            DataGridViewTextBoxColumn colFiller = new DataGridViewTextBoxColumn();\r\n";
            ___result += "            colFiller.Name = \"FILLER\";\r\n";
            ___result += "            colFiller.HeaderText = \"\";\r\n";
            ___result += "            colFiller.ReadOnly = true;\r\n";
            ___result += "            colFiller.DefaultCellStyle.BackColor = Color.WhiteSmoke;\r\n";
            ___result += "            colFiller.SortMode = DataGridViewColumnSortMode.NotSortable;\r\n";
            ___result += "            colFiller.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;\r\n";
            ___result += "            listgrid.Columns.Add(colFiller);\r\n";
            ___result += "}\r\n";

            ___result += "\r\n";
            ___result += "            #endregion[Init Grid]\r\n";
            ___result += "\r\n";

            #endregion [Init Grid]

            #region [Grid Action]

            ___result += "         #region[Grid Action]\r\n";
            ___result += "\r\n";
            ___result += "         void Listgrid_RowAction(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             if (listgrid.SelectedRow == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 return;\r\n";
            ___result += "             }\r\n";
            ___result += "             if (f" + SMALL + " == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + " = new F" + UPPERFIRST + "();\r\n";
            ___result += "             }\r\n";
            ___result += "             BuildForm();\r\n";
            ___result += "             string pkValue = GetSelectedPkValue();\r\n";
            ___result += "             if (pkValue != null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + ".SetAction(BtnEvent.Open, pkValue);\r\n";
            ___result += "             }\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Grid Action]\r\n";
            ___result += "\r\n";

            #endregion [Grid Action]

            #region [Enter Event]
            ___result += "         #region[Enter Event]\r\n";
            ___result += "\r\n";
            ___result += "         private void Txt_" + SMALL + "type_Enter(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             Change_infocus();\r\n";
            ___result += "             lbl_" + SMALL + "_name.BackColor = Theme.lbl_EnterBackColor;\r\n";
            ___result += "             lbl_" + SMALL + "_name.BorderColor = Theme.lbl_EnterBorderColor;\r\n";
            ___result += "             lbl_" + SMALL + "_name.ForeColor = Theme.lbl_EnterForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "         private void Change_infocus()\r\n";
            ___result += "         {\r\n";
            ___result += "             lbl_" + SMALL + "_name.BackColor = Theme.lbl_BackColor;\r\n";
            ___result += "             lbl_" + SMALL + "_name.BorderColor = Theme.lbl_BorderColor;\r\n";
            ___result += "             lbl_" + SMALL + "_name.ForeColor = Theme.lbl_ForeColor;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Enter Event]\r\n";
            ___result += "\r\n";

            #endregion [Enter Event]

            #region [Build Form]

            ___result += "         #region[Build Form]\r\n";
            ___result += "\r\n";
            ___result += "         private void BuildForm()\r\n";
            ___result += "         {\r\n";
            ___result += "             if (f" + SMALL + " == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 f" + SMALL + " = new F" + UPPERFIRST + "();\r\n";
            ___result += "             }\r\n";
            ___result += "             f" + SMALL + ".F" + UPPERFIRST + "_NeedToRefresh += V" + UPPERFIRST + "_NeedToRefresh;\r\n";
            ___result += "             Parent.Controls.Add(f" + SMALL + ");\r\n";
            ___result += "             f" + SMALL + ".Dock = DockStyle.Fill;\r\n";
            ___result += "             f" + SMALL + ".Show();\r\n";
            ___result += "             f" + SMALL + ".BringToFront();\r\n";
            ___result += "             \r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Build Form]\r\n";
            ___result += "\r\n";

            #endregion [Build Form]

            #region [Checkbox Event]

            ___result += "         #region[Checkbox Event] \r\n";
            ___result += "\r\n";
            ___result += "                private void Chk_notactive_CheckedChanged(object sender, EventArgs e) \r\n";
            ___result += "                { \r\n";
            ___result += "                    List_Option(ListOption.notactive); \r\n";
            ___result += "                } \r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Checkbox Event] \r\n";
            ___result += "\r\n";
            #endregion [Checkbox Event]

            #region [Btn Event]


            ___result += "         #region[Btn Event] \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_refresh_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(ListOption.active);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_new_Click(object sender, EventArgs e) \r\n";
            ___result += "        { \r\n";
            ___result += "            BuildForm(); \r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.New, null); \r\n";
            ___result += "                f" + SMALL + ".SetFocus(); \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_edit_Click(object sender, EventArgs e) \r\n";
            ___result += "        { \r\n";
            ___result += "            BuildForm(); \r\n";
            ___result += "            string pkValue = GetSelectedPkValue(); \r\n";
            ___result += "            if (pkValue != null) \r\n";
            ___result += "            { \r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.Edit, pkValue); \r\n";
            ___result += "                f" + SMALL + ".SetFocus(); \r\n";
            ___result += "            } \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_delete_Click(object sender, EventArgs e) \r\n";
            ___result += "        { \r\n";
            ___result += "            BuildForm(); \r\n";
            ___result += "            string pkValue = GetSelectedPkValue(); \r\n";
            ___result += "            if (pkValue != null) \r\n";
            ___result += "            { \r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.Delete, pkValue); \r\n";
            ___result += "                f" + SMALL + ".SetFocus(); \r\n";
            ___result += "            } \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_print_Click(object sender, EventArgs e) \r\n";
            ___result += "        { \r\n";
            ___result += "            BuildForm(); \r\n";
            ___result += "            string pkValue = GetSelectedPkValue(); \r\n";
            ___result += "            if (pkValue != null) \r\n";
            ___result += "            { \r\n";
            ___result += "                f" + SMALL + ".SetAction(BtnEvent.Print, pkValue); \r\n";
            ___result += "                f" + SMALL + ".SetFocus(); \r\n";
            ___result += "            } \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_close_Click(object sender, EventArgs e) \r\n";
            ___result += "        { \r\n";
            ___result += "            Hide(); \r\n";
            ___result += "            RaiseEvent_NeedToRefresh(); \r\n";
            ___result += "        } \r\n";
            ___result += "\r\n";
            ___result += "        private void Btn_search_Click(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(ListOption.Search);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Btn Event] \r\n";
            ___result += "\r\n";

            #endregion [Btn Event]

            #region [lookup]

            ___result += "         #region[lookup] \r\n";
            ___result += "\r\n";
            ___result += "         public void " + UPPERFIRST + "_lookup()\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_" + list[0].Fieldsname.ToLower() + ".LookupColNames = new string[] { " + CAPITAL + "." + list[0].Fieldsname.ToUpper() + " };\r\n";
            ___result += "             txt_" + list[0].Fieldsname.ToLower() + ".LookupUpdate += txt_" + SMALL + "_LookupUpdate;\r\n";
            ___result += "             txt_" + list[0].Fieldsname.ToLower() + ".AllowNewEntry = true;\r\n";
            ___result += "             txt_" + list[0].Fieldsname.ToLower() + ".NewEntryNeeded += txt_" + SMALL + "_NewEntryNeeded;\r\n";
            ___result += "         }\r\n";
            ___result += "         void txt_" + SMALL + "_LookupUpdate(object sender, EventArgs e)\r\n";
            ___result += "         {\r\n";
            ___result += "             txt_" + list[0].Fieldsname.ToLower() + ".LookupList = C" + UPPERFIRST + "_exten.GetforLookup();\r\n";
            ___result += "         }\r\n";
            ___result += "         private F" + UPPERFIRST + " fs" + SMALL + " = null;\r\n";
            ___result += "         void txt_" + SMALL + "_NewEntryNeeded(object sender, string pValue)\r\n";
            ___result += "         {\r\n";
            ___result += "             if (fs" + SMALL + " == null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 fs" + SMALL + " = new F" + UPPERFIRST + "();\r\n";
            ___result += "             }\r\n";
            ___result += "             Parent.Controls.Add(fs" + SMALL + ");\r\n";
            ___result += "             fs" + SMALL + ".Dock = DockStyle.Fill;\r\n";
            ___result += "             fs" + SMALL + ".Show();\r\n";
            ___result += "             fs" + SMALL + ".BringToFront();\r\n";
            ___result += "             fs" + SMALL + ".Focus();\r\n";
            ___result += "             \r\n";
            ___result += "             fs" + SMALL + ".SetAction(BtnEvent.New, null);\r\n";
            ___result += "             fs" + SMALL + ".SetFocus();\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[lookup] \r\n";
            ___result += "\r\n";

            #endregion [" + CAMELCASE + " lookup]

            #region [Get selected pk value]

            ___result += "         #region[Get selected pk value]\r\n";
            ___result += "\r\n";
            ___result += "         private string GetSelectedPkValue()\r\n";
            ___result += "         {\r\n";
            ___result += "             DataGridViewRow vSelRow = null;\r\n";
            ___result += "             if (listgrid.SelectedRows != null && listgrid.SelectedRows.Count != 0)\r\n";
            ___result += "             {\r\n";
            ___result += "                 vSelRow = listgrid.SelectedRows[0];\r\n";
            ___result += "             }\r\n";
            ___result += "             \r\n";
            ___result += "             string selPkValue = null;\r\n";
            ___result += "             if (vSelRow != null)\r\n";
            ___result += "             {\r\n";
            ___result += "                 selPkValue = vSelRow.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value.ToString();\r\n";
            ___result += "             }\r\n";
            ___result += "             return selPkValue;\r\n";
            ___result += "         }\r\n";
            ___result += "\r\n";
            ___result += "         #endregion[Get selected pk value]\r\n";
            ___result += "\r\n";

            #endregion [Get selected pk value]

            #region [RaiseEvent]

            ___result += "        #region[RaiseEvent]\r\n";
            ___result += "\r\n";
            ___result += "        void V" + UPPERFIRST + "_NeedToRefresh(object sender, EventArgs e)\r\n";
            ___result += "        {\r\n";
            ___result += "            List_Option(ListOption.active);\r\n";
            ___result += "        }\r\n";
            ___result += "\r\n";
            //___result += "        public event EventHandler L" + UPPERFIRST + "_NeedToRefresh;\r\n";
            //___result += "\r\n";
            //___result += "        public void RaiseEvent_NeedToRefresh()\r\n";
            //___result += "        {\r\n";
            //___result += "            L" + UPPERFIRST + "_NeedToRefresh?.Invoke(this, new EventArgs());\r\n";
            //___result += "        }\r\n";
            //___result += "\r\n";
            ___result += "        #endregion[RaiseEvent]\r\n";

            #endregion [RaiseEvent]

            #region [finally return]

            ___result += "\r\n";
            ___result += "}//cls\r\n";
            ___result += "}//ns\r\n";
            return(___result);

            #endregion [Finally return]
        }