Exemple #1
0
        public static MasterDetails Logics(int table_id)
        {
            MasterDetails mt = new MasterDetails()
            {
                Mastertable       = GetTables(table_id),
                Mastertablesitems = GetFields(table_id),
                Mastertablepath   = GetPath(table_id),
            };

            return(mt);
        }
        public static void Create(MasterDetails obj)
        {
            string tbl_name = obj.Mastertable.Mastertables_name;

            tbl_name = tbl_name.Remove((tbl_name).Length - 4).ToUpper();

            string vpath = CodeIT.NPath + obj.Mastertablepath.Contfolder;

            vpath = CDir.CheckDir(vpath);

            string result = XCreate(obj);

            File.WriteAllText(@"" + vpath + "\\" + tbl_name + ".cs", result);
        }
Exemple #3
0
        public static void XList_designer(MasterDetails obj)
        {
            string tbl_name = obj.Mastertable.Mastertables_name;

            tbl_name = tbl_name.Remove((tbl_name).Length - 4).UpperFirst();

            string vpath = CodeIT.NPath + obj.Mastertablepath.Listfolder;

            vpath = CDir.CheckDir(vpath);

            string result = XCreate(obj);

            File.WriteAllText(@"" + vpath + "\\L" + tbl_name + "_Designer.cs", result);
        }
        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);
        }
Exemple #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    = 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]
        }
Exemple #6
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.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 static 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]
        }
Exemple #7
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 [Designer]
            //
            ___result += "namespace " + vnamespaces + "\r\n";
            ___result += "        { \r\n";
            ___result += "    public partial class L" + 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]
            //
        }
Exemple #8
0
        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]

        }
Exemple #9
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]
        }
Exemple #10
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]

        }
Exemple #11
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]
        }
Exemple #12
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.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]
        }
Exemple #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 System.Windows.Forms;\r\n";
            ___result += "using CXLIB;\r\n";
            ___result += "using System.Drawing;\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 + "\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++)
            {

                ___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++)
            {
                ___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 += "            F" + UPPERFIRST + "_NeedToRefresh?.Invoke(this, new EventArgs());\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(); \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[GetName]

            ___result += "        #region[GetName]\r\n";
            ___result += "\r\n";
            ___result += "        public string GetName() \r\n";
            ___result += "        { \r\n";
            ___result += "            return txt_" + list[0].Fieldsname.ToLower() + ".Text; \r\n";
            ___result += "        } \r\n";
            ___result += "        public void setname(string pName) \r\n";
            ___result += "        { \r\n";
            ___result += "            txt_" + list[0].Fieldsname.ToLower() + ".Text = pName ; \r\n";
            ___result += "        } \r\n";

            #endregion[GetName]

            #region[Set Focus]

            ___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]

        }
Exemple #14
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]
        }
Exemple #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]
        }
Exemple #16
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]
        }