private static bool CheckData(Company obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + COMPANY.COMPANY_TBL + " WHERE " + COMPANY.COMPANY_ID + " = '" + company_id + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Company_id = redr[COMPANY.COMPANY_ID].ToString(); obj.Company_name = redr[COMPANY.COMPANY_NAME].ToString(); //obj.Display_name = redr[COMPANY.DISPLAY_NAME].ToString(); obj.City_id = CCity_exten.GetId_Name(ChangeCase.UpperFirst(obj.City_id)); obj.State_id = CState_exten.GetId_Name(ChangeCase.UpperFirst(obj.State_id)); obj.Country_id = CCountry_exten.GetId_Name(obj.Country_id.ToUpper()); obj.Pincode_id = CPincode_exten.GetId_Name(obj.Pincode_id.Replace(" ", string.Empty)); CCompany.Update(obj, new DAL()); return(true); } return(false); } }
private static void InsertData(Month obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Month_name = ChangeCase.UpperFirst(obj.Month_name); CMonth.Insert(obj, new DAL()); } ; }
private static void InsertData(Ordertype obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Ordertype_name = ChangeCase.UpperFirst(obj.Ordertype_name); COrdertype.Insert(obj, new DAL()); } ; }
private static void InsertData(Transport obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Transport_name = ChangeCase.UpperFirst(obj.Transport_name); CTransport.Insert(obj, new DAL()); } ; }
private static void InsertData(City obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.City_name = ChangeCase.UpperFirst(obj.City_name); CCity.Insert(obj, new DAL()); } ; }
private static void InsertData(Deliveredto obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Deliveredto_name = ChangeCase.UpperFirst(obj.Deliveredto_name); CDeliveredto.Insert(obj, new DAL()); } ; }
private static void InsertData(Party obj, string newDB) { if (CheckData(obj, newDB) == false) { obj.Party_name = obj.Party_name.ToUpper(); obj.City_id = CCity_exten.GetId_Name(ChangeCase.UpperFirst(obj.City_id)); obj.State_id = CState_exten.GetId_Name(ChangeCase.UpperFirst(obj.State_id)); obj.Country_id = CCountry_exten.GetId_Name(obj.Country_id.ToUpper()); obj.Pincode_id = CPincode_exten.GetId_Name(obj.Pincode_id.Replace(" ", string.Empty)); CParty.Insert(obj, new DAL()); } ; }
private Transport CollectData() { Transport fobj = new Transport() { Transport_id = vId, Transport_name = ChangeCase.UpperFirst(txt_transport_name.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private Ordertype CollectData() { Ordertype fobj = new Ordertype() { Ordertype_id = vId, Ordertype_name = ChangeCase.UpperFirst(txt_ordertype_name.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private City CollectData() { City fobj = new City() { City_id = vId, City_name = ChangeCase.UpperFirst(txt_city_name.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private Deliveredto CollectData() { Deliveredto fobj = new Deliveredto() { Deliveredto_id = vId, Deliveredto_name = ChangeCase.UpperFirst(txt_deliveredto_name.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private Party CollectData() { Party fobj = new Party() { Party_id = vId, Party_name = ChangeCase.ToUpper(txt_party_name.Text), Contacttype_id = CContacttype_exten.GetId_Name(txt_contacttype_id.Text), Contact_person = ChangeCase.UpperFirst(txt_contact_person.Text), Street_1 = txt_street1.Text, Street_2 = txt_street2.Text, City_id = CCity_exten.GetId_Name(txt_city_id.Text), State_id = CState_exten.GetId_Name(txt_state_id.Text), Country_id = CCountry_exten.GetId_Name(txt_country_id.Text), Pincode_id = CPincode_exten.GetId_Name(txt_pincode_id.Text), Phone = txt_phone.Text, Cell = txt_cell.Text, Email = txt_email.Text, Website = txt_website.Text, Gstin = ChangeCase.ToUpper(txt_gst.Text), Pan = txt_pan.Text, Opening_balance = ConvertTO.Decimal(txt_opening_balance.Text), Credit_days = ConvertTO.Decimal(txt_credit_days.Text), Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; if ((fobj.Contacttype_id == null) || (fobj.Contacttype_id == "")) { fobj.Contacttype_id = "1"; } if ((fobj.City_id == null) || (fobj.City_id == "")) { fobj.City_id = "1"; } if ((fobj.State_id == null) || (fobj.State_id == "")) { fobj.State_id = "1"; } if ((fobj.Country_id == null) || (fobj.Country_id == "")) { fobj.Country_id = "1"; } if ((fobj.Pincode_id == null) || (fobj.Pincode_id == "")) { fobj.Pincode_id = "1"; } return(fobj); }
private State CollectData() { State fobj = new State() { State_id = vId, State_name = ChangeCase.UpperFirst(txt_state_name.Text), State_code = txt_state_code.Text, Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private Month CollectData() { Month fobj = new Month() { Month_id = vId, Month_name = obj.Month_name = ChangeCase.UpperFirst(txt_month_name.Text).ToUpper(), Month_starts = txt_month_starts.Text, Month_ends = txt_month_ends.Text, Active_id = Core.Stative, Notes = txt_notes.Text, User_id = Current.User }; return(fobj); }
private static bool CheckData(Deliveredto obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + DELIVEREDTO.DELIVEREDTO_TBL + " WHERE " + DELIVEREDTO.DELIVEREDTO_NAME + " = '" + obj.Deliveredto_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Deliveredto_id = redr[DELIVEREDTO.DELIVEREDTO_ID].ToString(); obj.Deliveredto_name = ChangeCase.UpperFirst(obj.Deliveredto_name); CDeliveredto.Update(obj, new DAL()); return(true); } return(false); } }
private static bool CheckData(City obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + CITY.CITY_TBL + " WHERE " + CITY.CITY_NAME + " = '" + obj.City_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.City_id = redr[CITY.CITY_ID].ToString(); obj.City_name = ChangeCase.UpperFirst(obj.City_name); CCity.Update(obj, new DAL()); return(true); } return(false); } }
private static bool CheckData(Ordertype obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + ORDERTYPE.ORDERTYPE_TBL + " WHERE " + ORDERTYPE.ORDERTYPE_NAME + " = '" + obj.Ordertype_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Ordertype_id = redr[ORDERTYPE.ORDERTYPE_ID].ToString(); obj.Ordertype_name = ChangeCase.UpperFirst(obj.Ordertype_name); COrdertype.Update(obj, new DAL()); return(true); } return(false); } }
private static bool CheckData(Transport obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + TRANSPORT.TRANSPORT_TBL + " WHERE " + TRANSPORT.TRANSPORT_NAME + " = '" + obj.Transport_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Transport_id = redr[TRANSPORT.TRANSPORT_ID].ToString(); obj.Transport_name = ChangeCase.UpperFirst(obj.Transport_name); CTransport.Update(obj, new DAL()); return(true); } return(false); } }
private static bool CheckData(Party obj, string newDB) { string q = "USE " + newDB + "; "; q += "SELECT * FROM " + PARTY.PARTY_TBL + " WHERE " + PARTY.PARTY_NAME + " = '" + obj.Party_name + "'; "; using (IDataReader redr = new DAL().Listreader(q)) { while (redr.Read() == true) { obj.Party_id = redr[PARTY.PARTY_ID].ToString(); obj.Party_name = obj.Party_name.ToUpper(); obj.City_id = CCity_exten.GetId_Name(ChangeCase.UpperFirst(obj.City_id)); obj.State_id = CState_exten.GetId_Name(ChangeCase.UpperFirst(obj.State_id)); obj.Country_id = CCountry_exten.GetId_Name(obj.Country_id.ToUpper()); obj.Pincode_id = CPincode_exten.GetId_Name(obj.Pincode_id.Replace(" ", string.Empty)); CParty.Update(obj, new DAL()); return(true); } return(false); } }
private static string XCreate(BillTable obj) { List <SFieldsItems> list = obj.SFieldsItems; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; //string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region [using] ___result += "using System.Collections.Generic;\r\n"; //___result += "using System.Data;\r\n"; ___result += "using CXLIB;\r\n"; ___result += "\r\n"; #endregion [using] #region [namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{\r\n"; ___result += " public class C" + UPPERFIRST + "items \r\n"; ___result += " {\r\n"; #endregion [namespace] #region [Get New] ___result += "\r\n"; ___result += " #region[Get New]\r\n"; ___result += "\r\n"; ___result += " public static List<" + UPPERFIRST + "items> GetNew\r\n"; ___result += " {\r\n"; ___result += " get\r\n"; ___result += " {\r\n"; ___result += " List<" + UPPERFIRST + "items> list = new List<" + UPPERFIRST + "items>();\r\n"; ___result += "\r\n"; ___result += " " + UPPERFIRST + "items obj = new " + UPPERFIRST + "items()\r\n"; ___result += " {\r\n"; ___result += " " + UPPERFIRST + "items_id = string.Empty,\r\n"; for (int r = 0; r < list.Count; r++) { switch (list[r].Datatype) { //case DATATYPES.VARCHAR_500: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.VARCHAR_300: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.VARCHAR_200: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.VARCHAR_100: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.UNIQUE_500: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.INT: // ___result += " public int " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.FORIEGN: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.DATE: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.DATETIME: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.ENUM_Y_N: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; //case DATATYPES.SMALLINT: // ___result += " public string " + ChangeCase.UpperFirst(list[r].Fieldsname.ToLower()) + " { get; set; }\r\n"; // break; case DATATYPES.BOOLX: ___result += " " + list[r].Fieldsname.UpperFirst() + " = false,\r\n"; break; case DATATYPES.FALSEX: ___result += " " + list[r].Fieldsname.UpperFirst() + " = false,\r\n"; break; case DATATYPES.TRUEX: ___result += " " + list[r].Fieldsname.UpperFirst() + " = false,\r\n"; break; case DATATYPES.DECMIAL_3: ___result += " " + list[r].Fieldsname.UpperFirst() + " = decimal.Zero,\r\n"; break; case DATATYPES.DECMIAL_2: ___result += " " + list[r].Fieldsname.UpperFirst() + " = decimal.Zero,\r\n"; break; case DATATYPES.DOUBLE: ___result += " " + list[r].Fieldsname.UpperFirst() + " = 0,\r\n"; break; default: ___result += " " + list[r].Fieldsname.UpperFirst() + " = string.Empty,\r\n"; break; } } ___result += " };\r\n"; ___result += " list.Add(obj);\r\n"; ___result += " return list;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Get New]\r\n"; ___result += "\r\n"; #endregion [Get New] #region [Attach params ] ___result += " #region[Attach params]\r\n"; ___result += " \r\n"; ___result += " private static string AttachParams(string q, " + UPPERFIRST + "items v)\r\n"; ___result += " {\r\n"; //___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_ID + \"@\", \"\" + ConvertTO.SqlString(v." + UPPERFIRST + "items_id) + \"\");\r\n"; for (int r = 0; r <= list.Count - 1; r++) { switch (list[r].Datatype) { case DATATYPES.DATE: ___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDate(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n"; break; case DATATYPES.DATETIME: ___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDateTime(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n"; break; //case DATATYPES.INT: // sqlstr = "SqlInt"; // break; case DATATYPES.DECMIAL_2: ___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDecimal(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n"; break; case DATATYPES.DECMIAL_3: ___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlDecimal(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n"; break; default: ___result += " q = q.Replace(\"@\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@\", \"\" + ConvertTO.SqlString(v." + list[r].Fieldsname.UpperFirst() + ") + \"\");\r\n"; break; } } ___result += " return q;\r\n"; ___result += " }\r\n"; ___result += " #endregion[Attach params]\r\n"; ___result += " \r\n"; #endregion [Attach params ] #region [Insert] ___result += " #region[Insert]\r\n"; ___result += " \r\n"; ___result += " public static void Insert(List<" + UPPERFIRST + "items> list, " + xDAL + " dalsession)\r\n"; ___result += " {\r\n"; ___result += " for (int i = 0; i < list.Count; i++)\r\n"; ___result += " {\r\n"; ___result += " " + UPPERFIRST + "items obj = new " + UPPERFIRST + "items()\r\n"; ___result += " {\r\n"; //___result += " " + UPPERFIRST + "items_id = list[i]." + UPPERFIRST + "items_id,\r\n"; for (int r = 0; r < list.Count - 1; r++) { ___result += " " + list[r].Fieldsname.UpperFirst() + " = list[i]." + list[r].Fieldsname.UpperFirst() + ",\r\n"; } //remove , from last line for (int r = list.Count - 1; r < list.Count; r++) { ___result += " " + list[r].Fieldsname.UpperFirst() + " = list[i]." + list[r].Fieldsname.UpperFirst() + "\r\n"; } ___result += " };\r\n"; ___result += " InsertSub(obj, dalsession);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Insert]\r\n"; ___result += "\r\n"; #endregion [Insert] #region [Insert Sub] ___result += " #region[InsertSub]\r\n"; ___result += " \r\n"; ___result += " public static void InsertSub(" + UPPERFIRST + "items v, " + xDAL + " dalsession)\r\n"; ___result += " {\r\n"; ___result += " string q = \" INSERT INTO \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL + \" ( \";\r\n"; ___result += " q += \" \" + " + CAPITAL + "ITEMS." + list[0].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n"; for (int r = 1; r < list.Count; r++) { ___result += " q += \",\" + " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \" \\r\\n \";\r\n"; } ___result += " q += \" ) VALUES ( \";\r\n"; ___result += " q += \" @\"+ " + CAPITAL + "ITEMS." + list[0].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n"; for (int r = 1; r < list.Count; r++) { ___result += " q += \", @\"+ " + CAPITAL + "ITEMS." + list[r].Fieldsname.ToUpper() + " + \"@ \\r\\n \";\r\n"; } ___result += " q += \" ) \\r\\n \";\r\n"; ___result += " q = AttachParams(q, v);\r\n"; ___result += " dalsession.Execute(q);\r\n"; ___result += " }\r\n"; ___result += " #endregion[Insert]\r\n"; ___result += " \r\n"; #endregion [InsertSub] #region [Build delete query] ___result += " #region[Delete]\r\n"; ___result += " \r\n"; ___result += " public static void Delete(string fkid , " + xDAL + " dalsession)\r\n";; ___result += " {\r\n"; ___result += " dalsession.Execute(\"DELETE FROM \" + " + CAPITAL + "ITEMS." + CAPITAL + "ITEMS_TBL+ \" WHERE \" + " + CAPITAL + "ITEMS." + CAPITAL + "_ID + \" = \" + fkid +\";\");\r\n"; ___result += " }\r\n"; ___result += " #endregion[Delete]\r\n"; ___result += " \r\n"; #endregion [delete query] #region [result] ___result += " }//cls\r\n"; ___result += "}//ns\r\n"; return(___result); #endregion [result] }
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); }
private static string XCreate(MasterDetails obj) { List<MasterTablesItems> list = obj.Mastertablesitems; //List<SFieldsItems> sub = obj.MFieldsItems; string vtablesname = obj.Mastertable.Mastertables_name; string vnamespaces = obj.Mastertable.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region[using] ___result += "using System; \r\n"; //___result += "using System.ComponentModel; \r\n"; //___result += "using System.Collections.Generic; \r\n"; //___result += "using System.Drawing; \r\n"; ___result += "using System.Windows.Forms; \r\n"; ___result += "using CXLIB; \r\n"; ___result += " \r\n"; #endregion[using] #region[namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{ \r\n"; ___result += " public partial class F" + UPPERFIRST + "\r\n"; ___result += " { \r\n"; #endregion[namespace] #region[Action] ___result += " #region[Action]\r\n"; ___result += "\r\n"; ___result += " private BtnEvent fAction = BtnEvent.Open;\r\n"; ___result += " private " + UPPERFIRST + " obj;\r\n"; ___result += " private string vId;\r\n"; ___result += "\r\n"; ___result += " public void SetAction(BtnEvent action, string pk)\r\n"; ___result += " {\r\n"; ___result += " fAction = action;\r\n"; ___result += " \r\n"; ___result += " switch (fAction)\r\n"; ___result += " {\r\n"; ___result += " case BtnEvent.Open:\r\n"; ___result += " btn_save.Text = \"&CLOSE\";\r\n"; ___result += " obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n"; ___result += " this.EnableControls(false);\r\n"; ___result += " break;\r\n"; ___result += " case BtnEvent.New:\r\n"; ___result += " btn_save.Text = \"&SAVE\";\r\n"; ___result += " obj = C" + UPPERFIRST + ".GetNew;\r\n"; ___result += " this.EnableControls(true);\r\n"; ___result += " break;\r\n"; ___result += " case BtnEvent.Edit:\r\n"; ___result += " btn_save.Text = \"&UPDATE\";\r\n"; ___result += " obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n"; ___result += " this.EnableControls(true);\r\n"; ___result += " break;\r\n"; ___result += " case BtnEvent.Delete:\r\n"; ___result += " btn_save.Text = \"CONFIRM\\r\\n&DELETE\";\r\n"; ___result += " obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n"; ___result += " this.EnableControls(false);\r\n"; ___result += " break;\r\n"; ___result += " case BtnEvent.Print:\r\n"; ___result += " btn_save.Text = \"&PRINT\";\r\n"; ___result += " obj = C" + UPPERFIRST + "_exten.PKId(pk);\r\n"; ___result += " this.EnableControls(false);\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " \r\n"; ___result += " this.LoadData();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Action]\r\n"; ___result += "\r\n"; #endregion[Action] #region[Load Data] ___result += " #region[Load Data]\r\n"; ___result += "\r\n"; ___result += " private void LoadData()\r\n"; ___result += " {\r\n"; ___result += " vId = obj." + UPPERFIRST + "_id;\r\n"; for (int r = 0; r < list.Count; r++) { //if (list[r].Inputtype == InputControls.LOOKUPBOX) //{ // ___result += " txt_" + list[r].Fieldsname.ToLower() + ".Text = C" + (list[r].Fieldsname.UpperFirst()) + "_exten.GetName_Id(obj." + list[r].Fieldsname.UpperFirst() + ");\r\n"; //} //else //{ ___result += " txt_" + list[r].Fieldsname.ToLower() + ".Text = obj." + list[r].Fieldsname.UpperFirst() + ";\r\n"; // } } ___result += " txt_notes.Text = obj.Notes;\r\n"; ___result += " Core.Stative = obj.Active_id;\r\n"; ___result += " Setactives();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Load Data]\r\n"; ___result += "\r\n"; #endregion[Load Data] #region[Enable Disable Controls] ___result += " #region[Enable Disable Controls]\r\n"; ___result += "\r\n"; ___result += " private void EnableControls(bool pEnabled)\r\n"; ___result += " {\r\n"; ___result += " bool pReadOnly = !pEnabled;\r\n"; ___result += " \r\n"; for (int r = 0; r < list.Count; r++) { ___result += " txt_" + list[r].Fieldsname.ToLower() + ".Enabled = !pReadOnly;\r\n"; } ___result += " txt_notes.Enabled = !pReadOnly;\r\n"; ___result += " \r\n"; ___result += " btn_active.Enabled = !pReadOnly;\r\n"; ___result += " \r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Enable Disable Controls]\r\n"; ___result += "\r\n"; #endregion[Enable Disable Controls] #region[Save Event] ___result += " #region[Save Event]\r\n"; ___result += "\r\n"; ___result += " private " + xDAL + " dalsession;\r\n"; ___result += " private void Save_Event()\r\n"; ___result += " {\r\n"; ___result += " if (Validation() != false)\r\n"; ___result += " {\r\n"; ___result += " switch (fAction)\r\n"; ___result += " {\r\n"; ___result += " case BtnEvent.Open: \r\n "; ___result += " this.Hide(); \r\n "; ___result += " Form_NeedToRefresh(); \r\n "; ___result += " break; \r\n "; ___result += "\r\n "; ___result += " case BtnEvent.New: \r\n "; ___result += " try \r\n "; ___result += " { \r\n "; ___result += " var vData = CollectData(); \r\n "; ___result += "\r\n "; ___result += " dalsession = new " + xDAL + "(); \r\n "; ___result += " dalsession.BeginTransaction(); \r\n "; ___result += " C" + UPPERFIRST + ".Insert(vData, dalsession); \r\n "; ___result += " dalsession.Commit(); \r\n "; ___result += "\r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Record Saved Successfully.\", \"Save...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n "; ___result += " this.Hide(); \r\n "; ___result += " Form_NeedToRefresh(); \r\n "; ___result += " } \r\n "; ___result += " catch (Exception ex) \r\n "; ___result += " { \r\n "; ___result += " if (dalsession != null) \r\n "; ___result += " { \r\n "; ___result += " dalsession.Rollback(); \r\n "; ___result += " } \r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Save...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n "; ___result += " SetFocus(); \r\n "; ___result += " return; \r\n "; ___result += " } \r\n "; ___result += " break; \r\n "; ___result += "\r\n "; ___result += " case BtnEvent.Edit: \r\n "; ___result += " try \r\n "; ___result += " { \r\n "; ___result += " var vData = CollectData(); \r\n "; ___result += "\r\n "; ___result += " dalsession = new " + xDAL + "(); \r\n "; ___result += " dalsession.BeginTransaction(); \r\n "; ___result += " C" + UPPERFIRST + ".Update(vData, dalsession); \r\n "; ___result += " dalsession.Commit(); \r\n "; ___result += "\r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Record Updated Successfully.\", \"Update...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n "; ___result += " this.Hide(); \r\n "; ___result += " Form_NeedToRefresh(); \r\n "; ___result += " } \r\n "; ___result += " catch (Exception ex) \r\n "; ___result += " { \r\n "; ___result += " if (dalsession != null) \r\n "; ___result += " { \r\n "; ___result += " dalsession.Rollback(); \r\n "; ___result += " } \r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n "; ___result += " SetFocus(); \r\n "; ___result += " return; \r\n "; ___result += " } \r\n "; ___result += " break; \r\n "; ___result += " \r\n "; ___result += " case BtnEvent.Delete: \r\n "; ___result += " try \r\n "; ___result += " { \r\n "; ___result += " dalsession = new " + xDAL + "(); \r\n "; ___result += " dalsession.BeginTransaction(); \r\n "; ___result += " C" + UPPERFIRST + ".Delete(vId, dalsession); \r\n "; ___result += " dalsession.Commit(); \r\n "; ___result += "\r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Record Deleted Successfully.\", \"Delete...\", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); \r\n "; ___result += " this.Hide(); \r\n "; ___result += " Form_NeedToRefresh(); \r\n "; ___result += " } \r\n "; ___result += " catch (Exception ex) \r\n "; ___result += " { \r\n "; ___result += " if (dalsession != null) \r\n "; ___result += " { \r\n "; ___result += " dalsession.Rollback(); \r\n "; ___result += " } \r\n "; ___result += " MessageBox.Show(this.FindForm(), \"Something Goes Wrong \\r\\n\" + ex.Message, \"Could Not Update...\", MessageBoxButtons.OK, MessageBoxIcon.Error); \r\n "; ___result += " SetFocus(); \r\n "; ___result += " return; \r\n "; ___result += " } \r\n "; ___result += " break; \r\n "; ___result += "\r\n"; ___result += " case BtnEvent.Print:\r\n"; ___result += " this.Hide();\r\n"; ___result += " Form_NeedToRefresh();\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Save Event]\r\n"; ___result += "\r\n"; #endregion[Event] #region[Collect Data] ___result += " #region[Collect Data]\r\n"; ___result += "\r\n"; ___result += " private " + UPPERFIRST + " CollectData()\r\n"; ___result += " {\r\n"; ___result += " " + UPPERFIRST + " fobj = new " + UPPERFIRST + "()\r\n"; ___result += " {\r\n"; ___result += " " + UPPERFIRST + "_id = vId,\r\n"; for (int r = 0; r < list.Count; r++) { if (list[r].Inputtype == InputControls.LOOKUPBOX) { ___result += " " + list[r].Fieldsname.UpperFirst() + " = C" + (list[r].Fieldsname.UpperFirst()).Replace("_id", "") + "_exten.GetId_Name(txt_" + list[r].Fieldsname.ToLower() + ".Text),\r\n"; } else { ___result += " " + list[r].Fieldsname.UpperFirst() + " = txt_" + list[r].Fieldsname.ToLower() + ".Text,\r\n"; } } ___result += " Active_id = Core.Stative,\r\n"; ___result += " Notes = txt_notes.Text,\r\n"; ___result += " User_id = Current.User\r\n"; ___result += " };\r\n"; ___result += " return fobj;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[CollectData]\r\n"; ___result += "\r\n"; #endregion[Collect Data] #region[Validation] ___result += " #region[Validation]\r\n"; ___result += "\r\n"; ___result += " private bool Validation()\r\n"; ___result += " {\r\n"; for (int r = 0; r < list.Count; r++) { if (list[r].Validate == AutoCode.YES) { ___result += " if (txt_" + list[r].Fieldsname.ToLower() + ".Text.Trim().Length == 0)\r\n"; ___result += " {\r\n"; ___result += " MessageBox.Show(this.FindForm(), \"" + (list[r].Fieldsname.UpperFirst()).Replace("_", " ") + " should not Empty ! \", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n"; ___result += " txt_" + list[r].Fieldsname.ToLower() + ".Focus();\r\n"; ___result += " return false;\r\n"; ___result += " }\r\n"; ___result += " \r\n"; } } ___result += " if (Core.Stative == Core.Idle)\r\n"; ___result += " {\r\n"; ___result += " MessageBox.Show(this.FindForm(), \"Select Active or not !\", \"Warning...\", MessageBoxButtons.OK, MessageBoxIcon.Warning);\r\n"; ___result += " btn_active.Focus();\r\n"; ___result += " return false;\r\n"; ___result += " }\r\n"; ___result += " \r\n"; ___result += " return true;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Validation]\r\n"; ___result += "\r\n"; #endregion[Validation] #region[result] ___result += "}//cls \r\n"; ___result += "}//ns \r\n"; return ___result; #endregion[result] }
private static string XCreate(BillTable obj) { List <SFields> list = obj.SFields; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; //string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region [using] //___result += "using System;\r\n"; ___result += "using System.Windows.Forms;\r\n"; ___result += "using System.Collections.Generic;\r\n"; ___result += "using System.Drawing;\r\n"; ___result += "using CXLIB;\r\n"; ___result += "\r\n"; #endregion [using] #region [namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{\r\n"; ___result += " public partial class L" + UPPERFIRST + "\r\n"; ___result += " {\r\n"; #endregion [namespace] #region [list Option] ___result += " #region[list Option]\r\n"; ___result += "\r\n"; ___result += " public void ListRefresh()\r\n"; ___result += " {\r\n"; ___result += " List_Option(fAction);\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private ListOption fAction = ListOption.active;\r\n"; ___result += " public void List_Option(ListOption pAction)\r\n"; ___result += " {\r\n"; ___result += " fAction = pAction;\r\n"; ___result += " \r\n"; ___result += " switch (fAction)\r\n"; ___result += " {\r\n"; ___result += " case ListOption.refer:\r\n"; ___result += "\r\n"; ___result += " if (rdo_refer.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Refer());\r\n"; ___result += " }\r\n"; ___result += " else\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " break;\r\n"; ___result += "\r\n"; ___result += " case ListOption.showall:\r\n"; ___result += "\r\n"; ___result += " if (rdo_showall.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Showall());\r\n"; ___result += " }\r\n"; ___result += " else\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " break;\r\n"; ___result += "\r\n"; ___result += " case ListOption.notactive:\r\n"; ___result += "\r\n"; ___result += " if (rdo_notactive.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Notactive());\r\n"; ___result += " }\r\n"; ___result += " else\r\n"; ___result += " {\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " break;\r\n"; ___result += "\r\n"; ___result += " case ListOption.Search:\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Searchby(txt_no.Text, txt_date.Text, txt_Todate.Text, txt_party.Text ));\r\n"; ___result += " break;\r\n"; ___result += "\r\n"; ___result += " default:\r\n"; ___result += " LoadData(C" + UPPERFIRST + "_exten.Unrefer());\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[list Option]\r\n"; ___result += "\r\n"; #endregion [list Option] #region [Load Data] ___result += " #region[Load Data]\r\n"; ___result += "\r\n"; ___result += " public void LoadData(List<" + UPPERFIRST + "> list)\r\n"; ___result += " {\r\n"; ___result += " if (constructed_flag == false)\r\n"; ___result += " {\r\n"; ___result += " return;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " listgrid.SuspendLayout();\r\n"; ___result += "\r\n"; ___result += " listgrid.RowCount = 0;\r\n"; ___result += " listgrid.RowCount = list.Count;\r\n"; ___result += " for (int r = 0; r < list.Count; r++)\r\n"; ___result += " {\r\n"; ___result += " DataGridViewRow row = listgrid.Rows[r];\r\n"; ___result += " \r\n"; ___result += " row.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value = list[r]." + UPPERFIRST + "_id;\r\n"; for (int r = 0; r < list.Count; r++) { if (list[r].Inputtype != InputControls.None) { if (list[r].Inputtype == InputControls.DATEBOX) { ___result += " row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = ConvertTO.Date2S(list[r]." + list[r].Fieldsname.UpperFirst() + ");\r\n"; } else if (list[r].Inputtype == InputControls.DATETIMEBOX) { ___result += " row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = ConvertTO.DateTime12S(list[r]." + list[r].Fieldsname.UpperFirst() + ");\r\n"; } else { ___result += " row.Cells[" + CAPITAL + "." + list[r].Fieldsname.ToUpper() + "].Value = list[r]." + list[r].Fieldsname.UpperFirst() + ";\r\n"; } } } //___result += " row.Cells[" + CAPITAL + ".NOTES].Value = list[r].Notes;\r\n"; //___result += " row.Cells[" + CAPITAL + ".ACTIVE_ID].Value = list[r].Active_id;\r\n"; ___result += " row.Cells[" + CAPITAL + ".USER_ID].Value = list[r].User_id;\r\n"; ___result += "\r\n"; ___result += " switch (list[r].Locked)\r\n"; ___result += " {\r\n"; ___result += " case Core.Locked:\r\n"; ___result += " row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(0, 152, 70);\r\n"; ___result += " row.Cells[GRID.CELL].Style.ForeColor = Color.White;\r\n"; ___result += " row.Cells[GRID.CELL].Value = Core.Txt_Locked;\r\n"; ___result += " break;\r\n"; ___result += " case Core.Partial:\r\n"; ___result += " row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(255, 237, 0);\r\n"; ___result += " row.Cells[GRID.CELL].Style.ForeColor = Color.FromArgb(0, 141, 210);\r\n"; ___result += " row.Cells[GRID.CELL].Value = Core.Txt_Partial;\r\n"; ___result += "\r\n"; ___result += " break;\r\n"; ___result += " default:\r\n"; ___result += " row.Cells[GRID.CELL].Style.BackColor = Color.FromArgb(227, 30, 36);\r\n"; ___result += " row.Cells[GRID.CELL].Style.ForeColor = Color.White;\r\n"; ___result += " row.Cells[GRID.CELL].Value = Core.Txt_Unlocked;\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " listgrid.Refresh();\r\n"; ___result += " if (listgrid.RowCount != 0)\r\n"; ___result += " {\r\n"; ___result += " listgrid.CurrentCell = listgrid[" + CAPITAL + ".PARTY_ID, listgrid.RowCount - 1];\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += " listgrid.ResumeLayout(true);\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Load Data]\r\n"; ___result += "\r\n"; #endregion [Load Data] #region [finally return] ___result += "\r\n"; ___result += " }//cls\r\n"; ___result += "}//ns\r\n"; return(___result); #endregion [Finally return] }
// 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] }
private static string XCreate(BillTable obj) { List <SFields> list = obj.SFields; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; //string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region [using] ___result += "using System;\r\n"; ___result += "using System.Drawing;\r\n"; ___result += "using System.Windows.Forms;\r\n"; ___result += "using CXLIB;\r\n"; ___result += "\r\n"; #endregion [using] #region [namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{\r\n"; ___result += " public partial class L" + UPPERFIRST + "\r\n"; ___result += " {\r\n"; #endregion [namespace] #region [] ___result += "\r\n"; ___result += " private F" + UPPERFIRST + " f" + SMALL + " = null;\r\n"; ___result += " private bool constructed_flag = false;\r\n"; ___result += "\r\n"; ___result += " public L" + UPPERFIRST + "()\r\n"; ___result += " {\r\n"; ___result += " InitializeComponent();\r\n"; ___result += " Initialize();\r\n"; ___result += " InitGrid();\r\n"; ___result += " List_Option(ListOption.active);\r\n"; ___result += " No_lookup();\r\n"; //___result += " Date_lookup();\r\n"; ___result += " Party_lookup();\r\n"; //___result += " Getno_panel.Visible = false;\r\n"; ___result += " constructed_flag = true;\r\n"; ___result += " rdo_unrefer.Checked = true;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; #endregion [] #region [Private Declare] ___result += " #region[Private Declare]\r\n"; ___result += "\r\n"; ___result += " private XShadowPanel lpanel;\r\n"; ___result += " private Panel linner_panel;\r\n"; ___result += " private CloseButton btn_close;\r\n"; ___result += " private Header lbl_header;\r\n"; ___result += "\r\n"; ___result += " private XLabel lbl_no;\r\n"; ___result += " private LookupBox txt_no;\r\n"; ___result += " private XLabel lbl_date;\r\n"; ___result += " private xDatepicker txt_datePicker;\r\n"; ___result += " private XTextBox txt_date;\r\n"; ___result += " private XLabel lbl_dateTo;\r\n"; ___result += " private xDatepicker txt_TodatePicker;\r\n"; ___result += " private XTextBox txt_Todate;\r\n"; ___result += " private XLabel lbl_party;\r\n"; ___result += " private LookupBox txt_party;\r\n"; ___result += " private OfficeButton btn_search;\r\n"; ___result += "\r\n"; ___result += " private MRadioButton rdo_unrefer;\r\n"; ___result += " private MRadioButton rdo_refer;\r\n"; ___result += " private MRadioButton rdo_showall;\r\n"; ___result += " private MRadioButton rdo_notactive;\r\n"; ___result += "\r\n"; //___result += " private OfficeButton btn_quick;\r\n"; //___result += " private Panel Getno_panel;\r\n"; //___result += " private ShadowBox Getno_innerpanel;\r\n"; //___result += " private XTextBox txt_getno;\r\n"; //___result += " private XLabel lbl_getno;\r\n"; //___result += " private OfficeButton btn_generate;\r\n"; //___result += "\r\n"; ___result += " private OfficeButton btn_refresh;\r\n"; ___result += " private OfficeButton btn_new;\r\n"; ___result += " private OfficeButton btn_edit;\r\n"; ___result += " private OfficeButton btn_delete;\r\n"; ___result += " private OfficeButton btn_print;\r\n"; ___result += "\r\n"; ___result += " private ListGridView listgrid;\r\n"; ___result += "\r\n"; ___result += " #endregion[Private Declare]\r\n"; ___result += "\r\n"; #endregion [Private Declare] #region [Initialize] ___result += " #region[Initialize]\r\n"; ___result += "\r\n"; ___result += " private void Initialize()\r\n"; ___result += " {\r\n"; ___result += "\r\n"; ___result += " lpanel = new XShadowPanel();\r\n"; ___result += " linner_panel = new Panel();\r\n"; ___result += " btn_close = new CloseButton();\r\n"; ___result += " lbl_header = new Header();\r\n"; ___result += "\r\n"; ___result += " rdo_unrefer = new MRadioButton();\r\n"; ___result += " rdo_refer = new MRadioButton();\r\n"; ___result += " rdo_showall = new MRadioButton();\r\n"; ___result += " rdo_notactive = new MRadioButton();\r\n"; ___result += "\r\n"; ___result += " txt_no = new LookupBox();\r\n"; ___result += " lbl_no = new XLabel();\r\n"; ___result += " txt_date = new XTextBox();\r\n"; ___result += " txt_datePicker = new xDatepicker();\r\n"; ___result += " lbl_date = new XLabel();\r\n"; ___result += " txt_Todate = new XTextBox();\r\n"; ___result += " txt_TodatePicker = new xDatepicker();\r\n"; ___result += " lbl_dateTo = new XLabel();\r\n"; ___result += " txt_party = new LookupBox();\r\n"; ___result += " lbl_party = new XLabel();\r\n"; ___result += " btn_search = new OfficeButton();\r\n"; //___result += "\r\n"; //___result += " btn_quick = new OfficeButton();\r\n"; //___result += " Getno_panel = new Panel();\r\n"; //___result += " Getno_innerpanel = new ShadowBox();\r\n"; //___result += " txt_getno = new XTextBox();\r\n"; //___result += " lbl_getno = new XLabel();\r\n"; //___result += " btn_generate = new OfficeButton();\r\n"; ___result += "\r\n"; ___result += " btn_refresh = new OfficeButton();\r\n"; ___result += " btn_new = new OfficeButton();\r\n"; ___result += " btn_edit = new OfficeButton();\r\n"; ___result += " btn_delete = new OfficeButton();\r\n"; ___result += " btn_print = new OfficeButton();\r\n"; ___result += "\r\n"; ___result += " listgrid = new ListGridView();\r\n"; ___result += "\r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle();\r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle();\r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle();\r\n"; ___result += "\r\n"; ___result += " lpanel.SuspendLayout();\r\n"; ___result += " linner_panel.SuspendLayout();\r\n"; ___result += " ((System.ComponentModel.ISupportInitialize)(listgrid)).BeginInit();\r\n"; ___result += " SuspendLayout();\r\n"; ___result += "\r\n"; ___result += " linner_panel.Location = XLayout.LInnerPanel;\r\n"; ___result += " linner_panel.Name = \"linner_panel\";\r\n"; ___result += " linner_panel.Size = XSize.LInnerPanel;\r\n"; ___result += "\r\n"; ___result += " btn_close.Click += Btn_close_Click;\r\n"; ___result += "\r\n"; ___result += " lbl_header.Text = \"" + (obj.STables.Alias.Replace("_", " ")).UpperFirst() + "\";\r\n"; ___result += "\r\n"; ___result += " #endregion[Initialize]\r\n"; ___result += "\r\n"; #endregion [Initialize] #region [Add Control] ___result += " #region[Add Control]\r\n"; ___result += "\r\n"; ___result += " lpanel.Name = \"lpanel\";\r\n"; ___result += " lpanel.Dock = DockStyle.Fill;\r\n"; ___result += " lpanel.Size = XSize.FPanel;\r\n"; ___result += " lpanel.Location = XLayout.FPanel;\r\n"; ___result += " lpanel.BackColor = XTheme.FPanel;\r\n"; ___result += " lpanel.Controls.Add(linner_panel);\r\n"; ___result += " lpanel.Controls.Add(btn_close);\r\n"; ___result += " lpanel.Controls.Add(lbl_header);\r\n"; ___result += "\r\n"; ___result += " linner_panel.Anchor = XAnchor.LTRB;\r\n"; ___result += " linner_panel.BackColor = XTheme.LInnerpanel;\r\n"; ___result += "\r\n"; ___result += " linner_panel.Controls.Add(txt_no);\r\n"; ___result += " linner_panel.Controls.Add(lbl_no);\r\n"; ___result += " linner_panel.Controls.Add(txt_date);\r\n"; ___result += " linner_panel.Controls.Add(txt_datePicker);\r\n"; ___result += " linner_panel.Controls.Add(lbl_date);\r\n"; ___result += " linner_panel.Controls.Add(txt_Todate);\r\n"; ___result += " linner_panel.Controls.Add(txt_TodatePicker);\r\n"; ___result += " linner_panel.Controls.Add(lbl_dateTo);\r\n"; ___result += " linner_panel.Controls.Add(txt_party);\r\n"; ___result += " linner_panel.Controls.Add(lbl_party);\r\n"; ___result += " linner_panel.Controls.Add(btn_search);\r\n"; ___result += "\r\n"; ___result += " linner_panel.Controls.Add(rdo_unrefer);\r\n"; ___result += " linner_panel.Controls.Add(rdo_refer);\r\n"; ___result += " linner_panel.Controls.Add(rdo_showall);\r\n"; ___result += " linner_panel.Controls.Add(rdo_notactive);\r\n"; //___result += "\r\n"; //___result += " linner_panel.Controls.Add(btn_quick);\r\n"; //___result += " linner_panel.Controls.Add(Getno_panel);\r\n"; ___result += "\r\n"; ___result += " linner_panel.Controls.Add(btn_refresh);\r\n"; ___result += " linner_panel.Controls.Add(btn_new);\r\n"; ___result += " linner_panel.Controls.Add(btn_edit);\r\n"; ___result += " linner_panel.Controls.Add(btn_delete);\r\n"; ___result += " linner_panel.Controls.Add(btn_print);\r\n"; ___result += "\r\n"; ___result += " linner_panel.Controls.Add(listgrid);\r\n"; ___result += "\r\n"; ___result += " #endregion[Add Control]\r\n"; ___result += "\r\n"; #endregion [Add Control] #region [Search] ___result += " #region[Search]\r\n"; ___result += "\r\n"; ___result += " lbl_no.Font = XFont.Font_10B;\r\n"; ___result += " lbl_no.Name = \"lbl_no\";\r\n"; ___result += " lbl_no.Text = \"No\";\r\n"; ___result += " lbl_no.TextAlign = ContentAlignment.MiddleCenter;\r\n"; ___result += " lbl_no.ForeColor = XFontColor.Lbl_ForeColor;\r\n"; ___result += " lbl_no.Size = new Size(40, 28);\r\n"; ___result += " lbl_no.Location = XLayout.FirstLabel;\r\n"; ___result += "\r\n"; ___result += " txt_no.Font = XFont.TxtFont;\r\n"; ___result += " txt_no.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_no.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_no.Name = \"txt_no\";\r\n"; ___result += " txt_no.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n"; ___result += " txt_no.Size = new Size(120, 28);\r\n"; ___result += " txt_no.Anchor = XAnchor.LT;\r\n"; ___result += " txt_no.Location = new Point(lbl_no.Right - 1, lbl_no.Top);\r\n"; ___result += " txt_no.TabIndex = 6;\r\n"; ___result += "\r\n"; ___result += " lbl_date.Font = XFont.Font_10B;\r\n"; ___result += " lbl_date.Name = \"lbl_date\";\r\n"; ___result += " lbl_date.Text = \"Date\";\r\n"; ___result += " lbl_date.TextAlign = ContentAlignment.MiddleCenter;\r\n"; ___result += " lbl_date.ForeColor = XFontColor.Lbl_ForeColor;\r\n"; ___result += " lbl_date.Size = new Size(50, 28);\r\n"; ___result += " lbl_date.Location = new Point(txt_no.Right + 10, txt_no.Top);\r\n"; ___result += "\r\n"; ___result += " txt_date.Font = XFont.TxtFont;\r\n"; ___result += " txt_date.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_date.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_date.Name = \"txt_date\";\r\n"; ___result += " txt_date.Size = new Size(140, 28);\r\n"; ___result += " txt_date.Anchor = XAnchor.LT;\r\n"; ___result += " txt_date.Location = new Point(lbl_date.Right - 1, lbl_date.Top);\r\n"; ___result += " txt_date.TabIndex = 7;\r\n"; ___result += "\r\n"; ___result += " txt_datePicker.Font = XFont.TxtFont;\r\n"; ___result += " txt_datePicker.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_datePicker.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_datePicker.Name = \"txt_datePicker\";\r\n"; ___result += " txt_datePicker.CustomFormat = \" dd -MM-yyyy\";\r\n"; ___result += " txt_datePicker.Format = DateTimePickerFormat.Custom;\r\n"; ___result += " txt_datePicker.Size = new Size(170, 28);\r\n"; ___result += " txt_datePicker.Anchor = XAnchor.LT;\r\n"; ___result += " txt_datePicker.Location = new Point(lbl_date.Right - 1, lbl_date.Top);\r\n"; ___result += " txt_datePicker.TabIndex = 7;\r\n"; ___result += " txt_datePicker.TextChanged += Txt_datePicker_TextChanged;\r\n"; ___result += "\r\n"; ___result += " lbl_dateTo.Font = XFont.Font_10B;\r\n"; ___result += " lbl_dateTo.Name = \"lbl_date\";\r\n"; ___result += " lbl_dateTo.Text = \"To\";\r\n"; ___result += " lbl_dateTo.TextAlign = ContentAlignment.MiddleCenter;\r\n"; ___result += " lbl_dateTo.ForeColor = XFontColor.Lbl_ForeColor;\r\n"; ___result += " lbl_dateTo.Size = new Size(50, 28);\r\n"; ___result += " lbl_dateTo.Location = new Point(txt_datePicker.Right + 10, lbl_date.Top);\r\n"; ___result += "\r\n"; ___result += " txt_Todate.Font = XFont.TxtFont;\r\n"; ___result += " txt_Todate.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_Todate.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_Todate.Name = \"txt_dateTo\";\r\n"; ___result += " txt_Todate.Size = new Size(140, 28);\r\n"; ___result += " txt_Todate.Anchor = XAnchor.LT;\r\n"; ___result += " txt_Todate.Location = new Point(lbl_dateTo.Right - 1, lbl_date.Top);\r\n"; ___result += " txt_Todate.TabIndex = 7;\r\n"; ___result += "\r\n"; ___result += " txt_TodatePicker.Font = XFont.TxtFont;\r\n"; ___result += " txt_TodatePicker.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_TodatePicker.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_TodatePicker.Name = \"txt_dateTopicker\";\r\n"; ___result += " txt_TodatePicker.CustomFormat = \" dd -MM-yyyy\";\r\n"; ___result += " txt_TodatePicker.Format = DateTimePickerFormat.Custom;\r\n"; ___result += " txt_TodatePicker.Size = new Size(170, 28);\r\n"; ___result += " txt_TodatePicker.Anchor = XAnchor.LT;\r\n"; ___result += " txt_TodatePicker.Location = new Point(lbl_dateTo.Right - 1, lbl_date.Top);\r\n"; ___result += " txt_TodatePicker.TabIndex = 7;\r\n"; ___result += " txt_TodatePicker.TextChanged += Txt_TodatePicker_TextChanged;\r\n"; ___result += "\r\n"; ___result += " lbl_party.Font = XFont.Font_10B;\r\n"; ___result += " lbl_party.Name = \"lbl_party\";\r\n"; ___result += " lbl_party.Text = \"Party\";\r\n"; ___result += " lbl_party.TextAlign = ContentAlignment.MiddleCenter;\r\n"; ___result += " lbl_party.ForeColor = XFontColor.Lbl_ForeColor;\r\n"; ___result += " lbl_party.Size = new Size(80, 28);\r\n"; ___result += " lbl_party.Location = new Point(txt_TodatePicker.Right + 10, txt_datePicker.Top);\r\n"; ___result += "\r\n"; ___result += " txt_party.Font = XFont.TxtFont;\r\n"; ___result += " txt_party.ForeColor = XFontColor.TxtFontColor;\r\n"; ___result += " txt_party.BackColor = XTheme.TxtBackcolor;\r\n"; ___result += " txt_party.Name = \"txt_party\";\r\n"; ___result += " txt_party.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n"; ___result += " txt_party.Size = new Size(600, 28);\r\n"; ___result += " txt_party.Anchor = XAnchor.LT;\r\n"; ___result += " txt_party.Location = new Point(lbl_party.Right - 1, lbl_party.Top);\r\n"; ___result += " txt_party.TabIndex = 8;\r\n"; ___result += "\r\n"; ___result += " btn_search.Font = XFont.BtnFont;\r\n"; ___result += " btn_search.Location = new Point(txt_party.Right + 10, txt_party.Top);\r\n"; ___result += " btn_search.Size = new Size(75, 26);\r\n"; ___result += " btn_search.TabIndex = 1;\r\n"; ___result += " btn_search.Name = \"btn_search\";\r\n"; ___result += " btn_search.Text = \"&Search\";\r\n"; ___result += " btn_search.Themes = XTheme.YellowBtn;\r\n"; ___result += " btn_search.Anchor = XAnchor.TR;\r\n"; ___result += " btn_search.Click += Btn_search_Click;\r\n"; ___result += "\r\n"; ___result += " #endregion[Search]\r\n"; ___result += "\r\n"; #endregion [Search] #region [Radio btn] ___result += " #region[Radio btn]\r\n"; ___result += "\r\n"; ___result += " rdo_unrefer.Anchor = XAnchor.TR;\r\n"; ___result += " rdo_unrefer.AutoSize = false;\r\n"; ___result += " rdo_unrefer.Font = XFont.TxtFont;\r\n"; ___result += " rdo_unrefer.Location = new Point(XSize.FPanel_width - 160, 60);\r\n"; ___result += " rdo_unrefer.MouseLocation = new Point(-1, -1);\r\n"; ___result += " rdo_unrefer.Name = \"rdo_unrefer\";\r\n"; ___result += " rdo_unrefer.Size = new Size(200, 30);\r\n"; ___result += " rdo_unrefer.TabIndex = 2;\r\n"; ___result += " rdo_unrefer.Text = \"UN " + AutoCode.GetCaption(obj.STables.Stables_id, "rdo_unrefer") + "\";\r\n"; ___result += " rdo_unrefer.CheckedChanged += new EventHandler(Rdo_unrefer_CheckedChanged);\r\n"; ___result += "\r\n"; ___result += " rdo_refer.Anchor = XAnchor.TR;\r\n"; ___result += " rdo_refer.AutoSize = false;\r\n"; ___result += " rdo_refer.Font = XFont.TxtFont;\r\n"; ___result += " rdo_refer.Location = new Point(rdo_unrefer.Left, rdo_unrefer.Bottom + 20);\r\n"; ___result += " rdo_refer.MouseLocation = new Point(-1, -1);\r\n"; ___result += " rdo_refer.Name = \"rdo_refer\";\r\n"; ___result += " rdo_refer.Size = new Size(200, 30);\r\n"; ___result += " rdo_refer.TabIndex = 3;\r\n"; ___result += " rdo_refer.Text = \" " + AutoCode.GetCaption(obj.STables.Stables_id, "rdo_refer") + "\";\r\n"; ___result += " rdo_refer.CheckedChanged += new EventHandler(Rdo_refer_CheckedChanged);\r\n"; ___result += "\r\n"; ___result += " rdo_showall.Anchor = XAnchor.TR;\r\n"; ___result += " rdo_showall.AutoSize = false;\r\n"; ___result += " rdo_showall.Font = XFont.TxtFont;\r\n"; ___result += " rdo_showall.Location = new Point(rdo_refer.Left, rdo_refer.Bottom + 20);\r\n"; ___result += " rdo_showall.MouseLocation = new Point(-1, -1);\r\n"; ___result += " rdo_showall.Name = \"rdo_showall\";\r\n"; ___result += " rdo_showall.Size = new Size(200, 30);\r\n"; ___result += " rdo_showall.TabIndex = 4;\r\n"; ___result += " rdo_showall.Text = \" SHOW ALL\";\r\n"; ___result += " rdo_showall.CheckedChanged += new EventHandler(Rdo_showall_CheckedChanged);\r\n"; ___result += "\r\n"; ___result += " rdo_notactive.Anchor = XAnchor.TR;\r\n"; ___result += " rdo_notactive.AutoSize = false;\r\n"; ___result += " rdo_notactive.Font = XFont.TxtFont;\r\n"; ___result += " rdo_notactive.Location = new Point(rdo_showall.Left, rdo_showall.Bottom + 20);\r\n"; ___result += " rdo_notactive.MouseLocation = new Point(-1, -1);\r\n"; ___result += " rdo_notactive.Name = \"rdo_notactive\";\r\n"; ___result += " rdo_notactive.Size = new Size(200, 30);\r\n"; ___result += " rdo_notactive.TabIndex = 6;\r\n"; ___result += " rdo_notactive.Text = \"NOT ACTIVE\";\r\n"; ___result += " rdo_notactive.CheckedChanged += new EventHandler(Rdo_notactive_CheckedChanged);\r\n"; ___result += "\r\n"; ___result += " #endregion[Radio btn]\r\n"; ___result += "\r\n"; #endregion [Radio btn] #region [btn Properties] ___result += " #region[btn Properties]\r\n"; ___result += "\r\n"; ___result += " btn_refresh.Font = XFont.BtnFont;\r\n"; ___result += " btn_refresh.Location = XLayout.BtnLocation(rdo_notactive.Location);\r\n"; ___result += " btn_refresh.Size = XSize.BtnOne;\r\n"; ___result += " btn_refresh.TabIndex = 1;\r\n"; ___result += " btn_refresh.Name = \"btn_refresh\";\r\n"; ___result += " btn_refresh.Text = \"&Refresh\";\r\n"; ___result += " btn_refresh.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_refresh.Anchor = XAnchor.TR;\r\n"; ___result += " btn_refresh.Click += Btn_refresh_Click;\r\n"; ___result += "\r\n"; ___result += " btn_new.Font = XFont.BtnFont;\r\n"; ___result += " btn_new.Location = XLayout.BtnLocation(btn_refresh.Location);\r\n"; ___result += " btn_new.Size = XSize.BtnOne;\r\n"; ___result += " btn_new.TabIndex = XTab.Index(btn_refresh.TabIndex);\r\n"; ___result += " btn_new.Name = \"btn_new\";\r\n"; ___result += " btn_new.Text = \"&New\";\r\n"; ___result += " btn_new.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_new.Anchor = XAnchor.TR;\r\n"; ___result += " btn_new.Click += Btn_new_Click;\r\n"; ___result += "\r\n"; ___result += " btn_edit.Font = XFont.BtnFont;\r\n"; ___result += " btn_edit.Location = XLayout.BtnLocation(btn_new.Location);\r\n"; ___result += " btn_edit.Size = XSize.BtnOne;\r\n"; ___result += " btn_edit.TabIndex = XTab.Index(btn_new.TabIndex);\r\n"; ___result += " btn_edit.Name = \"btn_edit\";\r\n"; ___result += " btn_edit.Text = \"&Edit\";\r\n"; ___result += " btn_edit.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_edit.Anchor = XAnchor.TR;\r\n"; ___result += " btn_edit.Click += Btn_edit_Click;\r\n"; ___result += "\r\n"; ___result += " btn_delete.Font = XFont.BtnFont;\r\n"; ___result += " btn_delete.Location = XLayout.BtnLocation(btn_edit.Location);\r\n"; ___result += " btn_delete.Size = XSize.BtnOne;\r\n"; ___result += " btn_delete.TabIndex = XTab.Index(btn_edit.TabIndex);\r\n"; ___result += " btn_delete.Name = \"btn_delete\";\r\n"; ___result += " btn_delete.Text = \"&Delete\";\r\n"; ___result += " btn_delete.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_delete.Anchor = XAnchor.TR;\r\n"; ___result += " btn_delete.Click += Btn_delete_Click;\r\n"; ___result += "\r\n"; ___result += " btn_print.Font = XFont.BtnFont;\r\n"; ___result += " btn_print.Location = XLayout.BtnLocation(btn_delete.Location);\r\n"; ___result += " btn_print.Size = XSize.BtnOne;\r\n"; ___result += " btn_print.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n"; ___result += " btn_print.Name = \"btn_print\";\r\n"; ___result += " btn_print.Text = \"&Print\";\r\n"; ___result += " btn_print.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_print.Anchor = XAnchor.TR;\r\n"; ___result += " btn_print.Click += Btn_print_Click;\r\n"; ___result += "\r\n"; //___result += " btn_quick.Font = XFont.BtnFont;\r\n"; //___result += " btn_quick.Location = XLayout.BtnLocation(btn_delete.Location);\r\n"; //___result += " btn_quick.Size = XSize.BtnOne;\r\n"; //___result += " btn_quick.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n"; //___result += " btn_quick.Name = \"btn_quick\";\r\n"; //___result += " btn_quick.Text = \"&Quick " + AutoCode.GetCaption(obj.STables.Stables_id, "btn_quick") + "\";\r\n"; //___result += " btn_quick.Themes = XTheme.PinkBtn;\r\n"; //___result += " btn_quick.Anchor = XAnchor.TR;\r\n"; //___result += " btn_quick.Click += Btn_quick_Click;\r\n"; //___result += "\r\n"; ___result += " #endregion[btn Properties]\r\n"; ___result += "\r\n"; #endregion [btn Properties] #region [Get no Panel] //___result += " #region[Get no Panel]\r\n"; //___result += "\r\n"; //___result += " Getno_panel.Size = new Size(300, 150);\r\n"; //___result += " Getno_panel.Location = new Point(btn_print.Left - 250, btn_print.Bottom - 40);\r\n"; //___result += " //Getno_panel.BackColor = XTheme.FPanel;\r\n"; //___result += " Getno_panel.BackColor = Color.Orange;\r\n"; //___result += " Getno_panel.Controls.Add(Getno_innerpanel);\r\n"; //___result += " Getno_innerpanel.Controls.Add(txt_getno);\r\n"; //___result += " Getno_innerpanel.Controls.Add(lbl_getno);\r\n"; //___result += " Getno_innerpanel.Controls.Add(btn_generate);\r\n"; //___result += "\r\n"; //___result += " Getno_innerpanel.Size = new Size(295, 145);\r\n"; //___result += " Getno_innerpanel.Location = new Point(2, 2);\r\n"; //___result += " Getno_innerpanel.BackColor = Color.White;\r\n"; //___result += "\r\n"; //___result += " lbl_getno.Font = XFont.Font_10B;\r\n"; //___result += " lbl_getno.Name = \"lbl_getno\";\r\n"; //___result += " lbl_getno.Text = \"No\";\r\n"; //___result += " lbl_getno.TextAlign = ContentAlignment.MiddleCenter;\r\n"; //___result += " lbl_getno.ForeColor = XFontColor.Lbl_ForeColor;\r\n"; //___result += " lbl_getno.Size = new Size(150, 28);\r\n"; //___result += " lbl_getno.Location = new Point(80, 20);\r\n"; //___result += " lbl_getno.BorderStyle = BorderStyle.None;\r\n"; //___result += " txt_getno.Font = XFont.TxtFont;\r\n"; //___result += " txt_getno.ForeColor = XFontColor.TxtFontColor;\r\n"; //___result += " txt_getno.BackColor = XTheme.TxtBackcolor;\r\n"; //___result += " txt_getno.Name = \"txt_getno\";\r\n"; //___result += " txt_getno.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor;\r\n"; //___result += " txt_getno.Size = new Size(150, 28);\r\n"; //___result += " txt_getno.Anchor = XAnchor.LT;\r\n"; //___result += " txt_getno.Location = new Point(lbl_getno.Left, lbl_getno.Bottom);\r\n"; //___result += "\r\n"; //___result += " btn_generate.Font = XFont.BtnFont;\r\n"; //___result += " btn_generate.Location = new Point(lbl_getno.Left, lbl_getno.Bottom + 40);\r\n"; //___result += " btn_generate.Size = new Size(150, 30);\r\n"; //___result += " btn_generate.TabIndex = XTab.Index(btn_print.TabIndex);\r\n"; //___result += " btn_generate.Name = \"btn_generate\";\r\n"; //___result += " btn_generate.Text = \"&Generate\";\r\n"; //___result += " btn_generate.Themes = XTheme.RedBtn;\r\n"; //___result += " btn_generate.Anchor = XAnchor.TR;\r\n"; //___result += " btn_generate.Click += Btn_generate_Click;\r\n"; //___result += "\r\n"; //___result += " #endregion[Get no Panel]\r\n"; //___result += "\r\n"; #endregion [Get no Panel] #region [List Grid] ___result += " #region[List Grid]\r\n"; ___result += "\r\n"; ___result += " listgrid.AllowUserToAddRows = false;\r\n"; ___result += " listgrid.AllowUserToDeleteRows = false;\r\n"; ___result += " listgrid.AllowUserToOrderColumns = true;\r\n"; ___result += " listgrid.AllowUserToResizeRows = false;\r\n"; ___result += " dataGridViewCellStyle1.BackColor = Color.White;\r\n"; ___result += " dataGridViewCellStyle1.Font = XFont.Font_10R;\r\n"; ___result += " dataGridViewCellStyle1.ForeColor = Color.Black;\r\n"; ___result += " dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(255, 255, 204);\r\n"; ___result += " dataGridViewCellStyle1.SelectionForeColor = Color.FromArgb(252, 0, 11);\r\n"; ___result += " dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True;\r\n"; ___result += " listgrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;\r\n"; ___result += " listgrid.Anchor = XAnchor.LTRB;\r\n"; ___result += " listgrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;\r\n"; ___result += " listgrid.BackgroundColor = Color.White;\r\n"; ___result += " listgrid.BorderStyle = BorderStyle.Fixed3D;\r\n"; ___result += " listgrid.CellBorderStyle = DataGridViewCellBorderStyle.Custom;\r\n"; ___result += " listgrid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Custom;\r\n"; ___result += " dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; ___result += " dataGridViewCellStyle2.BackColor = Color.FromArgb(132, 192, 96);\r\n"; ___result += " dataGridViewCellStyle2.Font = new Font(\"Microsoft Sans Serif\", 11.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));\r\n"; ___result += " dataGridViewCellStyle2.ForeColor = Color.White;\r\n"; ___result += " dataGridViewCellStyle2.Padding = new Padding(3);\r\n"; ___result += " dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight;\r\n"; ___result += " dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText;\r\n"; ___result += " dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True;\r\n"; ___result += " listgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;\r\n"; ___result += " listgrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;\r\n"; ___result += " listgrid.Cursor = Cursors.Default;\r\n"; ___result += " dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft;\r\n"; ___result += " dataGridViewCellStyle3.BackColor = Color.White;\r\n"; ___result += " dataGridViewCellStyle3.Font = XFont.Font_10R;\r\n"; ___result += " dataGridViewCellStyle3.ForeColor = Color.Black;\r\n"; ___result += " dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(255, 255, 204);\r\n"; ___result += " dataGridViewCellStyle3.SelectionForeColor = Color.FromArgb(252, 0, 11);\r\n"; ___result += " dataGridViewCellStyle3.WrapMode = DataGridViewTriState.False;\r\n"; ___result += " listgrid.DefaultCellStyle = dataGridViewCellStyle3;\r\n"; ___result += " listgrid.EnableHeadersVisualStyles = false;\r\n"; ___result += " listgrid.GridColor = Color.SeaGreen;\r\n"; ___result += " listgrid.MultiSelect = false;\r\n"; ___result += " listgrid.Name = \"listgrid\";\r\n"; ___result += " listgrid.ReadOnly = true;\r\n"; ___result += " listgrid.RowHeadersVisible = false;\r\n"; ___result += " listgrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect;\r\n"; ___result += " listgrid.Location = XLayout.ListView;\r\n"; ___result += " listgrid.Size = XSize.ListView;\r\n"; ___result += " listgrid.StandardTab = true;\r\n"; ___result += " listgrid.TabIndex = 0;\r\n"; ___result += "\r\n"; ___result += " #endregion[List Grid]\r\n"; ___result += "\r\n"; #endregion [List Grid] #region [List] ___result += "#region[List]\r\n"; ___result += "\r\n"; ___result += " AutoScaleDimensions = new SizeF(6F, 13F);\r\n"; ___result += " AutoScaleMode = AutoScaleMode.Font;\r\n"; ___result += " Controls.Add(lpanel);\r\n"; ___result += " Name = \"L" + UPPERFIRST + "\";\r\n"; ___result += " Size = new Size(1000, 600);\r\n"; ___result += " lpanel.ResumeLayout(false);\r\n"; ___result += " linner_panel.ResumeLayout(false);\r\n"; ___result += " linner_panel.PerformLayout();\r\n"; ___result += " ((System.ComponentModel.ISupportInitialize)(listgrid)).EndInit();\r\n"; ___result += " ResumeLayout(false);\r\n"; ___result += "\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += "#endregion[List]\r\n"; ___result += "\r\n"; #endregion [List] #region [Init Grid ] ___result += " #region[Init Grid]\r\n"; ___result += "\r\n"; ___result += " private void InitGrid()\r\n"; ___result += " {\r\n"; ___result += " listgrid.RowAction += Listgrid_RowAction;\r\n"; ___result += "\r\n"; ___result += " DataGridViewTextBoxColumn col_" + UPPERFIRST + "_Id = new DataGridViewTextBoxColumn();\r\n"; ___result += " col_" + UPPERFIRST + "_Id.Name = " + CAPITAL + "." + CAPITAL + "_ID;\r\n"; ___result += " col_" + UPPERFIRST + "_Id.HeaderText = \"" + CAPITAL + "_ID \";\r\n"; ___result += " col_" + UPPERFIRST + "_Id.Visible = false;\r\n"; ___result += " col_" + UPPERFIRST + "_Id.Width = 100;\r\n"; ___result += " col_" + UPPERFIRST + "_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; ___result += " col_" + UPPERFIRST + "_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; ___result += " listgrid.Columns.Add(col_" + UPPERFIRST + "_Id);\r\n"; ___result += "\r\n"; for (int r = 0; r < list.Count; r++) { if (list[r].Inputtype != InputControls.None) { string field = (list[r].Fieldsname.ToLower()).UpperFirst(); ___result += " DataGridViewTextBoxColumn col_" + field + " = new DataGridViewTextBoxColumn();\r\n"; ___result += " col_" + field + ".Name = " + CAPITAL + "." + list[r].Fieldsname + ";\r\n"; ___result += " col_" + field + ".HeaderText = \"" + list[r].Displayname.Replace("_", " ") + "\";\r\n"; ___result += " //col_" + field + ".Visible = false;\r\n"; if (field == "Party_id") { ___result += " col_" + field + ".Width = 300;\r\n"; ___result += " col_" + field + ".DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft;\r\n"; } else { ___result += " col_" + field + ".Width = " + Find.TxtLength_Point(list[r].Displayname) + ";\r\n"; ___result += " col_" + field + ".DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; } ___result += " col_" + field + ".AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; ___result += " listgrid.Columns.Add(col_" + field + ");\r\n"; ___result += "\r\n"; } } //___result += " DataGridViewTextBoxColumn col_Notes = new DataGridViewTextBoxColumn();\r\n"; //___result += " col_Notes.Name = " + CAPITAL + ".NOTES ;\r\n"; //___result += " col_Notes.HeaderText = \"NOTES\";\r\n"; //___result += " col_Notes.Visible = false;\r\n"; //___result += " col_Notes.Width = 200;\r\n"; //___result += " col_Notes.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; //___result += " col_Notes.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; //___result += " listgrid.Columns.Add(col_Notes );\r\n"; //___result += "\r\n"; //___result += " DataGridViewTextBoxColumn col_Active_Id = new DataGridViewTextBoxColumn();\r\n"; //___result += " col_Active_Id.Name = " + CAPITAL + ".ACTIVE_ID ;\r\n"; //___result += " col_Active_Id.HeaderText = \"ACTIVE ID\";\r\n"; //___result += " col_Active_Id.Visible = false;\r\n"; //___result += " col_Active_Id.Width = 200;\r\n"; //___result += " col_Active_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; //___result += " col_Active_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; //___result += " listgrid.Columns.Add(col_Active_Id );\r\n"; //___result += "\r\n"; ___result += " DataGridViewTextBoxColumn col_grid = new DataGridViewTextBoxColumn();\r\n"; ___result += " col_grid.Name = GRID.CELL;\r\n"; ___result += " col_grid.HeaderText = \"STATUS\";\r\n"; ___result += " //col_grid.Visible = false;\r\n"; ___result += " col_grid.Width = 120;\r\n"; ___result += " col_grid.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; ___result += " col_grid.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; ___result += " listgrid.Columns.Add(col_grid);\r\n"; ___result += "\r\n"; ___result += " DataGridViewTextBoxColumn col_User_Id = new DataGridViewTextBoxColumn();\r\n"; ___result += " col_User_Id.Name = " + CAPITAL + ".USER_ID;\r\n"; ___result += " col_User_Id.HeaderText = \"ENTRY BY\";\r\n"; ___result += " //col_User_Id.Visible = false;\r\n"; ___result += " col_User_Id.Width = 120;\r\n"; ___result += " col_User_Id.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;\r\n"; ___result += " col_User_Id.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;\r\n"; ___result += " listgrid.Columns.Add(col_User_Id);\r\n"; ___result += "\r\n"; ___result += " DataGridViewTextBoxColumn colFiller = new DataGridViewTextBoxColumn();\r\n"; ___result += " colFiller.Name = \"FILLER\";\r\n"; ___result += " colFiller.HeaderText = \"\";\r\n"; ___result += " colFiller.ReadOnly = true;\r\n"; ___result += " colFiller.DefaultCellStyle.BackColor = Color.WhiteSmoke;\r\n"; ___result += " colFiller.SortMode = DataGridViewColumnSortMode.NotSortable;\r\n"; ___result += " colFiller.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;\r\n"; ___result += " listgrid.Columns.Add(colFiller);\r\n"; ___result += "\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Init Grid]\r\n"; ___result += "\r\n"; #endregion [Init Grid] #region [result] ___result += " }//cls\r\n"; ___result += "}//ns\r\n"; return(___result); #endregion [result] }
private static string XCreate(BillTable obj) { List <SFields> list = obj.SFields; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; //string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region [using] ___result += "using System;\r\n"; //___result += "using System.Drawing;\r\n"; ___result += "using System.Windows.Forms;\r\n"; ___result += "using CXLIB;\r\n"; ___result += "using CXCORE;\r\n"; ___result += "\r\n"; #endregion [using] #region [namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{\r\n"; ___result += " public partial class L" + UPPERFIRST + " : CxControl\r\n"; ___result += " {\r\n"; #endregion [namespace] #region [Grid Action] ___result += " #region[Grid Action]\r\n"; ___result += "\r\n"; ___result += " void Listgrid_RowAction(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (listgrid.SelectedRow == null)\r\n"; ___result += " {\r\n"; ___result += " return;\r\n"; ___result += " }\r\n"; ___result += " if (f" + SMALL + " == null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + " = new F" + UPPERFIRST + "();\r\n"; ___result += " }\r\n"; ___result += " BuildForm();\r\n"; ___result += " string pkValue = GetSelectedPkValue();\r\n"; ___result += " if (pkValue != null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + ".SetAction(BtnEvent.Open, pkValue);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Grid Action]\r\n"; ___result += "\r\n"; #endregion [Grid Action] #region [Build Form] ___result += " #region[Build Form]\r\n"; ___result += "\r\n"; ___result += " private void BuildForm()\r\n"; ___result += " {\r\n"; ___result += " if (f" + SMALL + " == null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + " = new F" + UPPERFIRST + "();\r\n"; ___result += " }\r\n"; ___result += " f" + SMALL + ".F" + UPPERFIRST + "_NeedToRefresh += V" + UPPERFIRST + "_NeedToRefresh;\r\n"; ___result += " Parent.Controls.Add(f" + SMALL + ");\r\n"; ___result += " f" + SMALL + ".Dock = DockStyle.Fill;\r\n"; ___result += " f" + SMALL + ".Show();\r\n"; ___result += " f" + SMALL + ".BringToFront();\r\n"; ___result += "\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Build Form]\r\n"; ___result += "\r\n"; #endregion [Build Form] #region [Radio btn event] ___result += " #region[Radio btn event]\r\n"; ___result += "\r\n"; ___result += " private void Rdo_unrefer_CheckedChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (rdo_unrefer.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.unrefer);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Rdo_refer_CheckedChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (rdo_refer.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.refer);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Rdo_showall_CheckedChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (rdo_showall.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.showall);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Rdo_notactive_CheckedChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (rdo_notactive.Checked == true)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.notactive);\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Radio btn event]\r\n"; ___result += "\r\n"; #endregion [Radio btn event] #region [Btn Event] ___result += " #region[Btn Event]\r\n"; ___result += "\r\n"; ___result += " private void Btn_refresh_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.active);\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_new_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " BuildForm();\r\n"; ___result += " f" + SMALL + ".SetAction(BtnEvent.New, null);\r\n"; ___result += " f" + SMALL + ".SetFocus();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_edit_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " string pkValue = GetSelectedPkValue();\r\n"; //___result += " if (CPo_exten.LockStatus(pkValue) == false)\r\n"; //___result += " {\r\n"; ___result += " BuildForm();\r\n"; ___result += " if (pkValue != null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + ".SetAction(BtnEvent.Edit, pkValue);\r\n"; ___result += " f" + SMALL + ".SetFocus();\r\n"; ___result += " }\r\n"; //___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_delete_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " string pkValue = GetSelectedPkValue();\r\n"; //___result += " if (CPo_exten.LockStatus(pkValue) == false)\r\n"; //___result += " {\r\n"; ___result += " BuildForm();\r\n"; ___result += " if (pkValue != null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + ".SetAction(BtnEvent.Delete, pkValue);\r\n"; ___result += " f" + SMALL + ".SetFocus();\r\n"; ___result += " }\r\n"; //___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_print_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " BuildForm();\r\n"; ___result += " string pkValue = GetSelectedPkValue();\r\n"; ___result += " if (pkValue != null)\r\n"; ___result += " {\r\n"; ___result += " f" + SMALL + ".SetAction(BtnEvent.Print, pkValue);\r\n"; ___result += " f" + SMALL + ".SetFocus();\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_close_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " Hide();\r\n"; ___result += " RaiseEvent_NeedToRefresh();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Btn_search_Click(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.Search);\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Btn Event]\r\n"; ___result += "\r\n"; #endregion [Btn Event] #region [text change event] ___result += " #region[text change event]\r\n"; ___result += "\r\n"; ___result += " private void Txt_datePicker_TextChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " txt_date.Text = txt_datePicker.Text;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Txt_TodatePicker_TextChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " txt_Todate.Text = txt_TodatePicker.Text;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[text change event]\r\n"; ___result += "\r\n"; #endregion [text change event] #region [Enter Event] ___result += " #region[Enter Event]\r\n"; ___result += "\r\n"; ___result += " private void Txt_no_Enter(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " Change_infocus();\r\n"; ___result += " lbl_no.BackColor = XTheme.lbl_EnterBackColor;\r\n"; ___result += " lbl_no.BorderColor = XTheme.lbl_EnterBorderColor;\r\n"; ___result += " lbl_no.ForeColor = XTheme.lbl_EnterForeColor;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Txt_date_Enter(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " lbl_date.BackColor = XTheme.lbl_EnterBackColor;\r\n"; ___result += " lbl_date.BorderColor = XTheme.lbl_EnterBorderColor;\r\n"; ___result += " lbl_date.ForeColor = XTheme.lbl_EnterForeColor;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Txt_party_Enter(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " lbl_party.BackColor = XTheme.lbl_EnterBackColor;\r\n"; ___result += " lbl_party.BorderColor = XTheme.lbl_EnterBorderColor;\r\n"; ___result += " lbl_party.ForeColor = XTheme.lbl_EnterForeColor;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " private void Change_infocus()\r\n"; ___result += " {\r\n"; ___result += "\r\n"; ___result += " lbl_no.BackColor = XTheme.lbl_BackColor;\r\n"; ___result += " lbl_no.BorderColor = XTheme.lbl_BorderColor;\r\n"; ___result += " lbl_no.ForeColor = XTheme.lbl_ForeColor;\r\n"; ___result += "\r\n"; ___result += " lbl_date.BackColor = XTheme.lbl_BackColor;\r\n"; ___result += " lbl_date.BorderColor = XTheme.lbl_BorderColor;\r\n"; ___result += " lbl_date.ForeColor = XTheme.lbl_ForeColor;\r\n"; ___result += "\r\n"; ___result += " lbl_party.BackColor = XTheme.lbl_BackColor;\r\n"; ___result += " lbl_party.BorderColor = XTheme.lbl_BorderColor;\r\n"; ___result += " lbl_party.ForeColor = XTheme.lbl_ForeColor;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Enter Event]\r\n"; ___result += "\r\n"; #endregion [Enter Event] #region [lookup] ___result += " #region[No lookup]\r\n"; ___result += "\r\n"; ___result += " public void No_lookup()\r\n"; ___result += " {\r\n"; ___result += " txt_no.LookupColNames = new string[] { " + CAPITAL + "." + CAPITAL + "_NO };\r\n"; ___result += " txt_no.LookupUpdate += Txt_no_LookupUpdate;\r\n"; ___result += " }\r\n"; ___result += " void Txt_no_LookupUpdate(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " txt_no.LookupList = C" + UPPERFIRST + "_exten.LookupNo();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[No lookup]\r\n"; ___result += "\r\n"; ___result += " #region[Party lookup]\r\n"; ___result += "\r\n"; ___result += " public void Party_lookup()\r\n"; ___result += " {\r\n"; ___result += " txt_party.LookupColNames = new string[] { PARTY.PARTY_NAME };\r\n"; ___result += " txt_party.LookupUpdate += Txt_party_LookupUpdate;\r\n"; ___result += " }\r\n"; ___result += " void Txt_party_LookupUpdate(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " txt_party.LookupList = CParty_exten.GetforLookup(new DAL());\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Party lookup]\r\n"; ___result += "\r\n"; #endregion [lookup] #region [Get selected pk value] ___result += " #region[Get selected pk value]\r\n"; ___result += "\r\n"; ___result += " private string GetSelectedPkValue()\r\n"; ___result += " {\r\n"; ___result += " DataGridViewRow vSelRow = null;\r\n"; ___result += " if (listgrid.SelectedRows != null && listgrid.SelectedRows.Count != 0)\r\n"; ___result += " {\r\n"; ___result += " vSelRow = listgrid.SelectedRows[0];\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " string selPkValue = null;\r\n"; ___result += " if (vSelRow != null)\r\n"; ___result += " {\r\n"; ___result += " selPkValue = vSelRow.Cells[" + CAPITAL + "." + CAPITAL + "_ID].Value.ToString();\r\n"; ___result += " }\r\n"; ___result += " return selPkValue;\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Get selected pk value]\r\n"; ___result += "\r\n"; #endregion [Get selected pk value] #region [RaiseEvent] ___result += " #region[RaiseEvent]\r\n"; ___result += "\r\n"; ___result += " void V" + UPPERFIRST + "_NeedToRefresh(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " List_Option(ListOption.active);\r\n"; ___result += " }\r\n"; //___result += " public event EventHandler L" + UPPERFIRST + "_NeedToRefresh;\r\n"; //___result += " public void RaiseEvent_NeedToRefresh()\r\n"; //___result += " {\r\n"; //___result += " L" + UPPERFIRST + "_NeedToRefresh?.Invoke(this, new EventArgs());\r\n"; //___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[RaiseEvent]\r\n"; ___result += "\r\n"; #endregion [RaiseEvent] #region [finally return] ___result += " }//cls\r\n"; ___result += "}//ns\r\n"; return(___result); #endregion [Finally return] }
private static string XCreate(MasterDetails obj) { List <MasterTablesItems> list = obj.Mastertablesitems; string vtablesname = obj.Mastertable.Mastertables_name; string vnamespaces = obj.Mastertable.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; //string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy hh:mm:ss tt") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region [using] ___result += "using System; \r\n"; ___result += "using System.Drawing; \r\n"; ___result += "using System.Windows.Forms; \r\n"; ___result += "using CXLIB; \r\n"; ___result += " \r\n"; #endregion [using] #region [namespace] ___result += "namespace " + vnamespaces + " \r\n"; ___result += "{ \r\n"; ___result += " public partial class L" + UPPERFIRST + ": CxControl\r\n"; ___result += " { \r\n"; #endregion [namespace] #region [] ___result += "\r\n"; ___result += " private F" + UPPERFIRST + " f" + SMALL + " = null;\r\n"; ___result += "\r\n"; ___result += " public L" + UPPERFIRST + "()\r\n"; ___result += " {\r\n"; ___result += " InitializeComponent();\r\n"; ___result += " Initialize();\r\n"; ___result += " InitGrid();\r\n"; ___result += " List_Option(ListOption.active);\r\n"; ___result += " " + UPPERFIRST + "_lookup();\r\n"; ___result += " }\r\n"; ___result += " \r\n"; #endregion [] #region [Private Declare] ___result += " #region[Private Declare] \r\n"; ___result += " \r\n"; ___result += " private XShadowPanel lpanel; \r\n"; ___result += " private Panel linner_panel; \r\n"; ___result += " private MCheckBox chk_notactive; \r\n"; ___result += " private OfficeButton btn_search; \r\n"; ___result += " private LookupBox txt_" + SMALL + "_name; \r\n"; ___result += " private XLabel lbl_" + SMALL + "_name; \r\n"; ___result += " private CloseButton btn_close; \r\n"; ___result += " private Header lbl_header; \r\n"; ___result += " private OfficeButton btn_print; \r\n"; ___result += " private OfficeButton btn_delete; \r\n"; ___result += " private OfficeButton btn_edit; \r\n"; ___result += " private OfficeButton btn_new; \r\n"; ___result += " private OfficeButton btn_refresh; \r\n"; ___result += " private ListGridView listgrid; \r\n"; ___result += " \r\n"; ___result += " #endregion[Private Declare] \r\n"; ___result += " \r\n"; #endregion [Private Declare] ___result += " #region[Initialize] \r\n"; ___result += " private void Initialize() \r\n"; ___result += " { \r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); \r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle2 = new DataGridViewCellStyle(); \r\n"; ___result += " DataGridViewCellStyle dataGridViewCellStyle3 = new DataGridViewCellStyle(); \r\n"; ___result += " lpanel = new XShadowPanel(); \r\n"; ___result += " linner_panel = new Panel(); \r\n"; ___result += " chk_notactive = new MCheckBox(); \r\n"; ___result += " txt_" + SMALL + "_name = new LookupBox(); \r\n"; ___result += " lbl_" + SMALL + "_name = new XLabel(); \r\n"; ___result += " btn_close = new CloseButton(); \r\n"; ___result += " lbl_header = new Header(); \r\n"; ___result += " btn_print = new OfficeButton(); \r\n"; ___result += " btn_delete = new OfficeButton(); \r\n"; ___result += " btn_edit = new OfficeButton(); \r\n"; ___result += " btn_new = new OfficeButton(); \r\n"; ___result += " btn_refresh = new OfficeButton(); \r\n"; ___result += " listgrid = new ListGridView(); \r\n"; ___result += " btn_search = new OfficeButton(); \r\n"; ___result += " lpanel.SuspendLayout(); \r\n"; ___result += " linner_panel.SuspendLayout(); \r\n"; ___result += " ((System.ComponentModel.ISupportInitialize)(listgrid)).BeginInit(); \r\n"; ___result += " SuspendLayout(); \r\n"; ___result += "\r\n"; ___result += " lpanel.Name = \"lpanel\"; \r\n"; ___result += " lpanel.Dock = DockStyle.Fill; \r\n"; ___result += " lpanel.Size = XSize.FPanel; \r\n"; ___result += " lpanel.Location =XLayout.FPanel; \r\n"; ___result += " lpanel.BackColor = XTheme.FPanel;\r\n"; ___result += " lpanel.Controls.Add(linner_panel); \r\n"; ___result += " lpanel.Controls.Add(btn_close);\r\n"; ___result += " lpanel.Controls.Add(lbl_header);\r\n"; ___result += "\r\n"; ___result += " linner_panel.Anchor = XAnchor.LTRB; \r\n"; ___result += " linner_panel.BackColor = XTheme.LInnerpanel; \r\n"; ___result += " linner_panel.Controls.Add(btn_search); \r\n"; ___result += " linner_panel.Controls.Add(chk_notactive); \r\n"; ___result += " linner_panel.Controls.Add(txt_" + SMALL + "_name); \r\n"; ___result += " linner_panel.Controls.Add(lbl_" + SMALL + "_name); \r\n"; ___result += " linner_panel.Controls.Add(btn_print); \r\n"; ___result += " linner_panel.Controls.Add(btn_delete); \r\n"; ___result += " linner_panel.Controls.Add(btn_edit); \r\n"; ___result += " linner_panel.Controls.Add(btn_new); \r\n"; ___result += " linner_panel.Controls.Add(btn_refresh); \r\n"; ___result += " linner_panel.Controls.Add(listgrid); \r\n"; ___result += " linner_panel.Location = XLayout.LInnerPanel; \r\n"; ___result += " linner_panel.Name = \"linner_panel\"; \r\n"; ___result += " linner_panel.Size = XSize.LInnerPanel;\r\n"; ___result += "\r\n"; ___result += " btn_close.Click += Btn_close_Click; \r\n"; ___result += "\r\n"; ___result += " lbl_header.Text = \"" + ((obj.Mastertable.Alias).Replace("_", " ")).UpperFirst() + "\";\r\n"; ___result += "\r\n"; ___result += " chk_notactive.Anchor = XAnchor.TR;\r\n"; ___result += " chk_notactive.AutoSize = true; \r\n"; ___result += " chk_notactive.Font = XFont.TxtFont;\r\n"; ___result += " chk_notactive.Location = XLayout.ListFirstBtn;\r\n"; ___result += " chk_notactive.MouseLocation = new Point(-1, -1); \r\n"; ___result += " chk_notactive.Name = \"chk_notactive\"; \r\n"; ___result += " chk_notactive.Size = new Size(92, 30); \r\n"; ___result += " chk_notactive.TabIndex = 4; \r\n"; ___result += " chk_notactive.Text = \"Not Active\"; \r\n"; ___result += " chk_notactive.CheckedChanged += new System.EventHandler(Chk_notactive_CheckedChanged); \r\n"; ___result += "\r\n"; ___result += " txt_" + SMALL + "_name.Font = XFont.TxtFont; \r\n"; ___result += " txt_" + SMALL + "_name.ForeColor = XFontColor.TxtFontColor; \r\n"; ___result += " txt_" + SMALL + "_name.BackColor = XTheme.TxtBackcolor; \r\n"; ___result += " txt_" + SMALL + "_name.Name = \"txt_" + SMALL + "_name\"; \r\n"; ___result += " txt_" + SMALL + "_name.ReadOnlyBackColor = XTheme.TxtReadonlyBackcolor; \r\n"; ___result += " txt_" + SMALL + "_name.Size = XSize.TwoText; \r\n"; ___result += " txt_" + SMALL + "_name.Anchor = XAnchor.LTR; \r\n"; ___result += " txt_" + SMALL + "_name.Location = XLayout.FirstText; \r\n"; ___result += " txt_" + SMALL + "_name.TabIndex = 5; \r\n"; ___result += "\r\n"; ___result += " lbl_" + SMALL + "_name.Font = XFont.Font_10B; \r\n"; ___result += " lbl_" + SMALL + "_name.Name = \"lbl_" + SMALL + "_name\"; \r\n"; ___result += " lbl_" + SMALL + "_name.Text = \"" + ((obj.Mastertable.Alias).Replace("_", " ")).UpperFirst() + "\";\r\n"; ___result += " lbl_" + SMALL + "_name.TextAlign = ContentAlignment.MiddleCenter; \r\n"; ___result += " lbl_" + SMALL + "_name.ForeColor = XFontColor.Lbl_ForeColor; \r\n"; ___result += " lbl_" + SMALL + "_name.Size = XSize.OneLabel; \r\n"; ___result += " lbl_" + SMALL + "_name.Location = XLayout.FirstLabel; \r\n"; ___result += "\r\n"; ___result += " btn_search.Font = XFont.BtnFont;\r\n"; ___result += " btn_search.Location = new Point(txt_" + SMALL + "_name.Right + 10 ,txt_" + SMALL + "_name.Top);\r\n"; ___result += " btn_search.Size = new Size(75, 26); \r\n"; ___result += " btn_search.TabIndex = 1;\r\n"; ___result += " btn_search.Name = \"btn_search\";\r\n"; ___result += " btn_search.Text = \"&Search\";\r\n"; ___result += " btn_search.Themes = XTheme.YellowBtn;\r\n"; ___result += " btn_search.Anchor = XAnchor.TR;\r\n"; ___result += " btn_search.Click += Btn_search_Click;\r\n"; ___result += "\r\n"; ___result += " #region[btn Properties] \r\n"; ___result += "\r\n"; ___result += " btn_refresh.Font = XFont.BtnFont;\r\n"; ___result += " btn_refresh.Location = XLayout.BtnLocation(chk_notactive.Location);\r\n"; ___result += " btn_refresh.Size = XSize.BtnOne;\r\n"; ___result += " btn_refresh.TabIndex = 1;\r\n"; ___result += " btn_refresh.Name = \"btn_refresh\";\r\n"; ___result += " btn_refresh.Text = \"&Refresh\";\r\n"; ___result += " btn_refresh.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_refresh.Anchor = XAnchor.TR;\r\n"; ___result += " btn_refresh.Click += Btn_refresh_Click;\r\n"; ___result += "\r\n"; ___result += " btn_new.Font = XFont.BtnFont;\r\n"; ___result += " btn_new.Location = XLayout.BtnLocation(btn_refresh.Location);\r\n"; ___result += " btn_new.Size = XSize.BtnOne;\r\n"; ___result += " btn_new.TabIndex = XTab.Index(btn_refresh.TabIndex);\r\n"; ___result += " btn_new.Name = \"btn_new\";\r\n"; ___result += " btn_new.Text = \"&New\";\r\n"; ___result += " btn_new.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_new.Anchor = XAnchor.TR;\r\n"; ___result += " btn_new.Click += Btn_new_Click;\r\n"; ___result += "\r\n"; ___result += " btn_edit.Font = XFont.BtnFont;\r\n"; ___result += " btn_edit.Location = XLayout.BtnLocation(btn_new.Location);\r\n"; ___result += " btn_edit.Size = XSize.BtnOne;\r\n"; ___result += " btn_edit.TabIndex = XTab.Index(btn_new.TabIndex);\r\n"; ___result += " btn_edit.Name = \"btn_edit\";\r\n"; ___result += " btn_edit.Text = \"&Edit\";\r\n"; ___result += " btn_edit.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_edit.Anchor = XAnchor.TR;\r\n"; ___result += " btn_edit.Click += Btn_edit_Click;\r\n"; ___result += "\r\n"; ___result += " btn_delete.Font = XFont.BtnFont;\r\n"; ___result += " btn_delete.Location = XLayout.BtnLocation(btn_edit.Location);\r\n"; ___result += " btn_delete.Size = XSize.BtnOne;\r\n"; ___result += " btn_delete.TabIndex = XTab.Index(btn_edit.TabIndex);\r\n"; ___result += " btn_delete.Name = \"btn_delete\";\r\n"; ___result += " btn_delete.Text = \"&Delete\";\r\n"; ___result += " btn_delete.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_delete.Anchor = XAnchor.TR;\r\n"; ___result += " btn_delete.Click += Btn_delete_Click;\r\n"; ___result += "\r\n"; ___result += " btn_print.Font = XFont.BtnFont;\r\n"; ___result += " btn_print.Location = XLayout.BtnLocation(btn_delete.Location);\r\n"; ___result += " btn_print.Size = XSize.BtnOne;\r\n"; ___result += " btn_print.TabIndex = XTab.Index(btn_delete.TabIndex);\r\n"; ___result += " btn_print.Name = \"btn_print\";\r\n"; ___result += " btn_print.Text = \"&Print\";\r\n"; ___result += " btn_print.Themes = XTheme.BlueBtn;\r\n"; ___result += " btn_print.Anchor = XAnchor.TR;\r\n"; ___result += " btn_print.Click += Btn_print_Click;\r\n"; ___result += "\r\n"; ___result += " #endregion[btn Properties] \r\n"; ___result += "\r\n"; ___result += " #region[List Grid] \r\n"; ___result += "\r\n"; ___result += " listgrid.AllowUserToAddRows = false; \r\n"; ___result += " listgrid.AllowUserToDeleteRows = false; \r\n"; ___result += " listgrid.AllowUserToOrderColumns = true; \r\n"; ___result += " listgrid.AllowUserToResizeRows = false; \r\n"; ___result += " dataGridViewCellStyle1.BackColor = Color.White; \r\n"; ___result += " dataGridViewCellStyle1.Font = XFont.Font_10R; \r\n"; ___result += " dataGridViewCellStyle1.ForeColor = Color.Black; \r\n"; ___result += " dataGridViewCellStyle1.SelectionBackColor = Color.FromArgb(255,255,204); \r\n"; ___result += " dataGridViewCellStyle1.SelectionForeColor = Color.FromArgb(252,0,11); \r\n"; ___result += " dataGridViewCellStyle1.WrapMode = DataGridViewTriState.True; \r\n"; ___result += " listgrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; \r\n"; ___result += " listgrid.Anchor = XAnchor.LTRB;\r\n"; ___result += " listgrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; \r\n"; ___result += " listgrid.BackgroundColor = Color.White; \r\n"; ___result += " listgrid.BorderStyle = BorderStyle.Fixed3D; \r\n"; ___result += " listgrid.CellBorderStyle = DataGridViewCellBorderStyle.Custom; \r\n"; ___result += " listgrid.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Custom; \r\n"; ___result += " dataGridViewCellStyle2.Alignment = DataGridViewContentAlignment.MiddleCenter; \r\n"; ___result += " dataGridViewCellStyle2.BackColor = Color.FromArgb(132,192,96); \r\n"; ___result += " dataGridViewCellStyle2.Font = new Font(\"Microsoft Sans Serif\", 11.25F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0))); \r\n"; ___result += " dataGridViewCellStyle2.ForeColor = Color.White; \r\n"; ___result += " dataGridViewCellStyle2.Padding = new Padding(3); \r\n"; ___result += " dataGridViewCellStyle2.SelectionBackColor = SystemColors.Highlight; \r\n"; ___result += " dataGridViewCellStyle2.SelectionForeColor = SystemColors.HighlightText; \r\n"; ___result += " dataGridViewCellStyle2.WrapMode = DataGridViewTriState.True; \r\n"; ___result += " listgrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; \r\n"; ___result += " listgrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; \r\n"; ___result += " listgrid.Cursor = Cursors.Default; \r\n"; ___result += " dataGridViewCellStyle3.Alignment = DataGridViewContentAlignment.MiddleLeft; \r\n"; ___result += " dataGridViewCellStyle3.BackColor = Color.White; \r\n"; ___result += " dataGridViewCellStyle3.Font = XFont.Font_10R; \r\n"; ___result += " dataGridViewCellStyle3.ForeColor = Color.Black; \r\n"; ___result += " dataGridViewCellStyle3.SelectionBackColor = Color.FromArgb(255,255,204); \r\n"; ___result += " dataGridViewCellStyle3.SelectionForeColor = Color.FromArgb(252,0,11); \r\n"; ___result += " dataGridViewCellStyle3.WrapMode = DataGridViewTriState.False; \r\n"; ___result += " listgrid.DefaultCellStyle = dataGridViewCellStyle3; \r\n"; ___result += " listgrid.EnableHeadersVisualStyles = false; \r\n"; ___result += " listgrid.GridColor = Color.SeaGreen; \r\n"; ___result += " listgrid.MultiSelect = false; \r\n"; ___result += " listgrid.Name = \"listgrid\"; \r\n"; ___result += " listgrid.ReadOnly = true; \r\n"; ___result += " listgrid.RowHeadersVisible = false; \r\n"; ___result += " listgrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; \r\n"; ___result += " listgrid.Location = XLayout.ListView; \r\n"; ___result += " listgrid.Size = XSize.ListView; \r\n"; ___result += " listgrid.StandardTab = true; \r\n"; ___result += " listgrid.TabIndex = 0; \r\n"; ___result += "\r\n"; ___result += " #endregion[List Grid] \r\n"; ___result += "\r\n"; ___result += " AutoScaleDimensions = new SizeF(6F, 13F); \r\n"; ___result += " AutoScaleMode = AutoScaleMode.Font; \r\n"; ___result += " Controls.Add(lpanel); \r\n"; ___result += " Name = \"L" + UPPERFIRST + "\"; \r\n"; ___result += " Size = new Size(1000, 600); \r\n"; ___result += " lpanel.ResumeLayout(false); \r\n"; ___result += " linner_panel.ResumeLayout(false); \r\n"; ___result += " linner_panel.PerformLayout(); \r\n"; ___result += " ((System.ComponentModel.ISupportInitialize)(listgrid)).EndInit(); \r\n"; ___result += " ResumeLayout(false); \r\n"; ___result += " \r\n"; ___result += " } \r\n"; ___result += " \r\n"; ___result += " #endregion[Initialize] \r\n"; ___result += " \r\n"; #region [result] ___result += " }//cls \r\n"; ___result += "}//ns \r\n"; return(___result); #endregion [result] }
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] }
private static string XCreate(BillTable obj) { List<SFields> list = obj.SFields; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; //string xDAL = "DAL"; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// " + DateTime.Now + "\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] #region[using] ___result += "using System;\r\n"; //___result += "using System.ComponentModel;\r\n"; //___result += "using System.Collections.Generic;\r\n"; ___result += "using System.Drawing;\r\n"; ___result += "using System.Windows.Forms;\r\n"; ___result += "using CXLIB;\r\n"; ___result += "using CXCORE;\r\n"; ___result += "\r\n"; #endregion[using] #region[namespace] ___result += "namespace " + vnamespaces + "\r\n"; ___result += "{\r\n"; ___result += " public partial class F" + UPPERFIRST + " : UserControl\r\n"; ___result += " {\r\n"; #endregion[namespace] #region[Grid Event] ___result += " #region[Grid Event]\r\n"; ___result += "\r\n"; ___result += " void Editgrid_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)\r\n"; ___result += " {\r\n"; ___result += " CalcTotals();\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void Editgrid_CellValidating(object sender, DataGridViewCellValidatingEventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (e.FormattedValue + \"\" == \"\")\r\n"; ___result += " {\r\n"; ___result += " return;\r\n"; ___result += " }\r\n"; ___result += " string vColName = editgrid.Columns[e.ColumnIndex].Name;\r\n"; ___result += " switch (vColName)\r\n"; ___result += " {\r\n"; ___result += " case " + CAPITAL + "ITEMS.QTY:\r\n"; ___result += " decimal newDecimal;\r\n"; ___result += " if (decimal.TryParse(e.FormattedValue.ToString(), out newDecimal) == false || newDecimal < 0)\r\n"; ___result += " {\r\n"; ___result += " MessageBox.Show(this.FindForm(), \"The value must be an number.\", \"Number Check...\", MessageBoxButtons.OK, MessageBoxIcon.Information);\r\n"; ___result += " editgrid.CancelEdit();\r\n"; ___result += " e.Cancel = true;\r\n"; ___result += " }\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void Editgrid_CellValueChanged(object sender, DataGridViewCellEventArgs e)\r\n"; ___result += " {\r\n"; ___result += " string vColName = editgrid.Columns[e.ColumnIndex].Name;\r\n"; ___result += " if (vColName != Core.SLNO && editgrid[Core.SLNO, e.RowIndex].Value + \"\" != \"*\")\r\n"; ___result += " {\r\n"; ___result += " for (int r = 0; r < editgrid.RowCount; r++)\r\n"; ___result += " {\r\n"; ___result += " DataGridViewRow row = editgrid.Rows[r];\r\n"; ___result += " row.Cells[Core.SLNO].Value = \" \" + (r + 1) + \"\";\r\n"; ___result += " CalcTotals();\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += " switch (vColName)\r\n"; ___result += " {\r\n"; ___result += " case " + CAPITAL + "ITEMS.QTY:\r\n"; if (obj.STables.Stables_id != "2") { ___result += " CalcAmount(e.RowIndex);\r\n"; } ___result += " CalcTotals();\r\n"; ___result += " break;\r\n"; if (obj.STables.Stables_id != "2") { ___result += " case " + CAPITAL + "ITEMS.PRICE:\r\n"; ___result += " CalcAmount(e.RowIndex);\r\n"; ___result += " CalcTotals();\r\n"; ___result += " break;\r\n"; } ___result += " }\r\n"; ___result += "\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void Editgrid_CurrentCellChanged(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " if (editgrid.Focused == false)\r\n"; ___result += " {\r\n"; ___result += " return;\r\n"; ___result += " }\r\n"; ___result += " if (editgrid.ReadOnly == true)\r\n"; ___result += " {\r\n"; ___result += " return;\r\n"; ___result += " }\r\n"; ___result += " if (editgrid.CurrentCell != null)\r\n"; ___result += " {\r\n"; ___result += " lookupRow = editgrid.CurrentCell.RowIndex;\r\n"; ___result += " lookupCol = editgrid.CurrentCell.ColumnIndex;\r\n"; ___result += " lookupColName = editgrid.Columns[lookupCol].Name;\r\n"; ___result += "\r\n"; ___result += " switch (lookupColName)\r\n"; ___result += " {\r\n"; ___result += " case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n"; ___result += " ShowLookupForm();\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Grid Event]\r\n"; ___result += "\r\n"; #endregion[Grid Event] #region[Calc Total] ___result += " #region[Calc Total]\r\n"; if (obj.STables.Stables_id != "2") { ___result += "\r\n"; ___result += " private void CalcAmount(int pRowIndex)\r\n"; ___result += " {\r\n"; ___result += " decimal vQty = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.QTY, pRowIndex].Value);\r\n"; ___result += " decimal vPrice = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.PRICE, pRowIndex].Value);\r\n"; ___result += " decimal vAmount = vQty * vPrice;\r\n"; ___result += " editgrid[" + CAPITAL + "ITEMS.SUB_TOTAL , pRowIndex].Value = ConvertTO.Decimal2d(vAmount.ToString());\r\n"; ___result += " }\r\n"; ___result += "\r\n"; } ___result += " private void CalcTotals()\r\n"; ___result += " {\r\n"; ___result += " decimal vTotQty = 0M;\r\n"; if (obj.STables.Stables_id != "2") { ___result += " decimal vSubTotal = 0M;\r\n"; } ___result += " for (int r = 0; r <= editgrid.Rows.Count - 1; r++)\r\n"; ___result += " {\r\n"; ___result += " decimal vQty = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.QTY, r].Value);\r\n"; ___result += " vTotQty += vQty;\r\n"; if (obj.STables.Stables_id != "2") { ___result += " decimal vTotal = Global.ToDecimal(editgrid[" + CAPITAL + "ITEMS.SUB_TOTAL, r].Value);\r\n"; ___result += " vSubTotal += vTotal;\r\n"; } ___result += " }\r\n"; ___result += " //\r\n"; ___result += " txt_total_qty.Text = vTotQty.ToString();\r\n"; if (obj.STables.Stables_id != "2") { ___result += " txt_total_amount.Text = vSubTotal.ToString();\r\n"; } ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Calc Total]\r\n"; ___result += "\r\n"; #endregion[Calc Total] #region[Look up] ___result += " #region[Look up]\r\n"; ___result += "\r\n"; ___result += " private int lookupRow;\r\n"; ___result += " private int lookupCol;\r\n"; ___result += " private string lookupColName;\r\n"; ___result += " private LookupForm frmLookup;\r\n"; ___result += " public void ShowLookupForm()\r\n"; ___result += " {\r\n"; ___result += " FrmLookup_LookupHide(null, null);\r\n"; ___result += "\r\n"; ___result += " frmLookup = new LookupForm();\r\n"; ___result += "\r\n"; ___result += " switch (lookupColName)\r\n"; ___result += " {\r\n"; ___result += "\r\n"; ___result += " case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n"; ___result += " {\r\n"; ___result += " frmLookup.LookupColNames = new string[] { PRODUCT.PRODUCT_NAME };\r\n"; ___result += " frmLookup.SelectedPkValue = editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value;\r\n"; ___result += " frmLookup.AllowNewEntry = true;\r\n"; ___result += " frmLookup.AllowEmptySelection = true;\r\n"; ___result += " \r\n"; ___result += " if (txt_party_id.Text != \"\")\r\n"; ___result += " {\r\n"; ___result += " frmLookup.LookupList = CProduct_exten.GetforLookup(new DAL());\r\n"; ___result += " frmLookup.LoadLookupList();\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += " break;\r\n"; ___result += "\r\n"; ___result += " default:\r\n"; ___result += " throw new System.Exception(\"'\" + lookupColName + \"' Not Found\");\r\n"; ___result += " }\r\n"; ___result += " frmLookup.LookupSelected += new EventHandler(FrmLookup_LookupSelected);\r\n"; ___result += " frmLookup.AfterSelection += new EventHandler(FrmLookup_AfterSelection);\r\n"; ___result += " frmLookup.LookupHide += new EventHandler(FrmLookup_LookupHide);\r\n"; ___result += " frmLookup.NewEntryNeeded += new LookupForm.NewEntryHandler(FrmLookup_NewEntryNeeded);\r\n"; ___result += " frmLookup.Owner = this.FindForm();\r\n"; ___result += " //////////\r\n"; ___result += " frmLookup.Show();\r\n"; ___result += " //////////\r\n"; ___result += " int vWidth = frmLookup.GetAutoWidth();\r\n"; ___result += " int vCellWidth = editgrid.Columns[lookupColName].Width;\r\n"; ___result += " if (vWidth < vCellWidth) vWidth = vCellWidth;\r\n"; ___result += " frmLookup.AutoFillLastColumn();\r\n"; ___result += "\r\n"; ___result += " int vHeight = frmLookup.GetAutoHeight();\r\n"; ___result += "\r\n"; ___result += " Rectangle screenRect = Global.GetScreenRect(editgrid);\r\n"; ___result += " frmLookup.Bounds = Global.GetSnapRect(screenRect, vWidth, vHeight);\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void FrmLookup_LookupSelected(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " System.Data.DataRow vEntity = frmLookup.SelectedEntity;\r\n"; ___result += "\r\n"; ___result += " switch (lookupColName)\r\n"; ___result += " {\r\n"; ___result += " case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n"; ___result += " if (vEntity == null)\r\n"; ___result += " {\r\n"; ___result += " editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = \"\";\r\n"; ___result += " }\r\n"; ___result += " else\r\n"; ___result += " {\r\n"; ___result += " editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = vEntity[PRODUCT.PRODUCT_NAME];\r\n"; ___result += " }\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void FrmLookup_AfterSelection(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " editgrid.FocusNextCell();\r\n"; ___result += " }\r\n"; ___result += " void FrmLookup_LookupHide(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " Application.DoEvents();\r\n"; ___result += " Application.DoEvents();\r\n"; ___result += " if (frmLookup != null)\r\n"; ___result += " {\r\n"; ___result += " frmLookup.Dispose();\r\n"; ___result += " frmLookup = null;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " void FrmLookup_NewEntryNeeded(object sender, string pValue)\r\n"; ___result += " {\r\n"; ___result += " switch (lookupColName)\r\n"; ___result += " {\r\n"; ___result += " case " + CAPITAL + "ITEMS.PRODUCT_ID:\r\n"; ___result += " FproductNewEntry(pValue);\r\n"; ___result += " break;\r\n"; ___result += " }\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion[Look up]\r\n"; ___result += "\r\n"; #endregion[Look up] #region [New Entry] ___result += " #region [New Entry]\r\n"; ___result += "\r\n"; ___result += " private FProduct xproduct = null;\r\n"; ___result += " void FproductNewEntry(string pValue)\r\n"; ___result += " {\r\n"; ___result += " if (xproduct == null)\r\n"; ___result += " {\r\n"; ___result += " xproduct = new FProduct();\r\n"; ___result += " xproduct.FProduct_NeedToRefresh += Xproduct_refresh;\r\n"; ___result += " }\r\n"; ___result += " this.Parent.Controls.Add(xproduct);\r\n"; ___result += " xproduct.Dock = DockStyle.Fill;\r\n"; ___result += " xproduct.Show();\r\n"; ___result += " xproduct.BringToFront();\r\n"; ___result += " xproduct.Focus();\r\n"; ___result += " xproduct.SetAction(BtnEvent.New, null);\r\n"; ___result += " xproduct.SetFocus();\r\n"; ___result += " xproduct.setname(pValue);\r\n"; ___result += " }\r\n"; ___result += " private void Xproduct_refresh(object sender, EventArgs e)\r\n"; ___result += " {\r\n"; ___result += " editgrid[" + CAPITAL + "ITEMS.PRODUCT_ID, lookupRow].Value = xproduct.GetName();\r\n"; ___result += " editgrid.Focus();\r\n"; ___result += " editgrid.CurrentCell = editgrid[" + CAPITAL + "ITEMS.QTY, lookupRow];\r\n"; ___result += "\r\n"; ___result += " }\r\n"; ___result += "\r\n"; ___result += " #endregion [New Entry]\r\n"; ___result += "\r\n"; #endregion [New Entry] #region[result] ___result += "}//cls\r\n"; ___result += "}//ns\r\n"; return ___result; #endregion[result] }
private static string XCreate(BillTable obj) { List <SFields> list = obj.SFields; string vtablesname = obj.STables.Stables_name; string vnamespaces = obj.STables.Namespaces_id; string TABLENAME = vtablesname.ToUpper(); string TRIM_TBL = vtablesname.Remove(vtablesname.Length - 4); string CAPITAL = cCultureInfo.toUpperCase(TRIM_TBL); string SMALL = cCultureInfo.toLowerCase(TRIM_TBL); string UPPERFIRST = ChangeCase.UpperFirst(SMALL); string ___result = ""; #endregion [] #region [Conclusion] ___result += "// " + CVersion_exten.Get_Current_Version() + "\r\n"; ___result += "// Auto Generated\r\n"; ___result += "// " + DateTime.Now + "\r\n"; ___result += "// last update : " + DateTime.Now.ToString("dd-MM-yyyy") + "\r\n"; ___result += "\r\n"; #endregion [Conclusion] // #region [Designer] // ___result += "namespace " + vnamespaces + "\r\n"; ___result += " { \r\n"; ___result += " public partial class F" + UPPERFIRST + "\r\n"; ___result += " {\r\n"; ___result += " private System.ComponentModel.IContainer components = null; \r\n"; ___result += " \r\n"; ___result += " protected override void Dispose(bool disposing) \r\n"; ___result += " {\r\n"; ___result += " if (disposing && (components != null)) \r\n"; ___result += " {\r\n"; ___result += " components.Dispose(); \r\n"; ___result += " }\r\n"; ___result += " base.Dispose(disposing); \r\n"; ___result += " }\r\n"; ___result += " \r\n"; //___result += " #region [InitializeComponent] \r\n"; ___result += " \r\n"; ___result += " private void InitializeComponent() \r\n"; ___result += " {\r\n"; ___result += " components = new System.ComponentModel.Container();\r\n"; ___result += " this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r\n"; ___result += " } \r\n"; ___result += " \r\n"; //___result += " #endregion [InitializeComponent] \r\n"; // #endregion [Designer] // #region [result] // ___result += " }//cls \r\n"; ___result += "}//ns \r\n"; // return(___result); // #endregion [result] // }