예제 #1
0
        private static string XCreate(MasterDetails obj)
        {
            List <MasterTablesItems> list = obj.Mastertablesitems;

            string vtablesname = obj.Mastertable.Mastertables_name;

            string vnamespaces = obj.Mastertable.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

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

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

            string ___result = "";

            #endregion []

            #region [Conclusion]

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

            #region [namespace]

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

            #endregion [namespace]

            #region [string Properties]

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

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

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

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

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

            #endregion [string Properties]

            #region [string Const class]

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

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

            #endregion [string Const class]

            #region [result]

            return(___result);
        }
예제 #2
0
        //
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

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

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

            string ___result = "";

            string xDAL = "SQLITE_DAL";

            //
            #endregion []

            #region [Conclusion]

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

            #endregion [Conclusion]

            #region [using]

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

            #endregion [using]

            #region [namespace]

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

            #endregion [namespace]

            #region [Get New]

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

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

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

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

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

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

            #endregion [Get New]

            #region [Attach params ]

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

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

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

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

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

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

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

                default:
                    sqlstr = "SqlString";
                    break;
                }

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

            #endregion [Attach params ]

            #region [Insert Query]

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

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

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

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

            #endregion [Insert Query]

            #region [Update query]

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

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

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

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

            #endregion [Update query]

            #region [Build delete query]

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

            #endregion [delete query]

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

            #endregion [result]
        }
예제 #3
0
        private static string XCreate(BillTable obj)
        {
            List<SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

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

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

            string xDAL = "DAL";

            #endregion []

            #region [Conclusion]

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

            #endregion [Conclusion]

            #region[using ]

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

            #endregion[using ]

            #region[namespace ]

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

            #endregion[namespace ]

            #region[Split Timer]

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

            #endregion [btn Split Timer]

            #region[Enter Event]

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

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

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

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

            #endregion[Enter Event]

            #region[btn Event ]

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

            #endregion[btn Event ]

            #region[Lbl Event]

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

            #endregion[Lbl Event]

            #region [Active Event]

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

            #endregion [Active Event]

            #region [RaiseEvent]

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

            #endregion [RaiseEvent]

            #region[Lookup]

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

                    string _field = string.Empty;

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

                    //_field = _structure[1].field;

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

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


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

            #endregion[Lookup]

            #region[Set Focus]

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

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

            #endregion[Set Focus]

            #region[result]

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

            return ___result;

            #endregion[result]

        }
예제 #4
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]
        }
예제 #5
0
        //
        private static string XCreate(BillTable obj)
        {
            List <SFields> list = obj.SFields;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            //string TABLENAME = vtablesname.ToUpper();

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

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

            string ___result = "";

            string xDAL = "DAL";

            //
            #endregion []

            #region [Conclusion]

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

            #endregion [Conclusion]

            #region [using]

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

            #endregion [using]

            #region [namespace]

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

            #endregion [namespace]

            #region [Entity Data]

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

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

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

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


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

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

            #endregion [Entity Data]

            #region [Entity List]

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

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

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


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

            #endregion [Entity List]

            #region [Unrefer]

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

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

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

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

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

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

            #endregion [Unrefer]

            #region [refer]

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

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

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

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

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

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

            #region [showall]

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

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

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

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

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

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

            #region [not active]

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

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

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

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

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

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

            #region [PKId]

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

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

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

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

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

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

            #endregion [PKId]

            #region [Searchby]

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

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

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

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

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

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

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

            #endregion [Searchby]

            #region [GetforLookup]

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

            #endregion [GetforLookup]

            #region [GetNext_No]

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

            #endregion [GetforLookup]

            #region [Lock Status]

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

            #endregion [Lock Status]

            #region [Get id - FieldsName]

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

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

            #endregion [result]
        }
예제 #6
0
        private static string XCreate(BillTable obj)
        {
            List <SFieldsItems> list = obj.SFieldsItems;

            string vtablesname = obj.STables.Stables_name;

            string vnamespaces = obj.STables.Namespaces_id;

            string TABLENAME = vtablesname.ToUpper();

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

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

            string ___result = "";

            #endregion []

            #region [Conclusion]

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

            #region [namespace]

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

            #endregion [namespace]

            #region [string Properties]

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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

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


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

            #endregion [string Properties]

            #region [string Const class]

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


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

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

            #endregion [string Const class]

            #region [result]

            return(___result);
        }