protected void BindGrid() { string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwINVOICES_ACTIVITIES" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); TypeConvert.AppendParameter(oQuery, true, "IS_OPEN", false); oQuery.CommandText += grdOpen.OrderByClause("DATE_DUE", "desc"); using (DataTable dt = oQuery.GetTable()) { foreach (DataRow row in dt.Rows) { switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"])) { case "Calls": row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) + " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]); break; } } vwOpen = new DataView(dt); grdOpen.DataSource = vwOpen; grdOpen.DataBind(); } oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); TypeConvert.AppendParameter(oQuery, false, "IS_OPEN", false); oQuery.CommandText += grdHistory.OrderByClause("DATE_MODIFIED", "desc"); using (DataTable dt = oQuery.GetTable()) { foreach (DataRow row in dt.Rows) { switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"])) { case "Calls": row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) + " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]); break; } } vwHistory = new DataView(dt); grdHistory.DataSource = vwHistory; grdHistory.DataBind(); } }
protected void BindGrid() { string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwINVOICES_ACTIVITIES" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); TypeConvert.AppendParameter(oQuery, true, "IS_OPEN", false); oQuery.CommandText += grdOpen.OrderByClause("DATE_DUE", "desc"); using (DataTable dt = oQuery.GetTable()) { foreach (DataRow row in dt.Rows) { switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"])) { case "Calls": row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) + " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]); break; } } vwOpen = new DataView(dt); grdOpen.DataSource = vwOpen; grdOpen.DataBind(); } oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list", "ACTIVITY_ASSIGNED_USER_ID"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); TypeConvert.AppendParameter(oQuery, false, "IS_OPEN", false); oQuery.CommandText += grdHistory.OrderByClause("DATE_MODIFIED", "desc"); using (DataTable dt = oQuery.GetTable()) { foreach (DataRow row in dt.Rows) { switch (CommonTypeConvert.ToString(row["ACTIVITY_TYPE"])) { case "Calls": row["STATUS"] = Translation.GetTranslation.Term(".call_direction_dom.", row["DIRECTION"]) + " " + Translation.GetTranslation.Term(".call_status_dom.", row["STATUS"]); break; } } vwHistory = new DataView(dt); grdHistory.DataSource = vwHistory; grdHistory.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["Administration_ProductCategories_Popup"].ToString(); oQuery.CommandText = innerSql; ctlSearch.SqlSearchClause(oQuery); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { if (String.IsNullOrEmpty(grdMain.SortColumn)) { grdMain.SortColumn = "NAME"; grdMain.SortOrder = "asc"; } grdMain.ApplySort(); grdMain.DataBind(); } }
public string[] ItemNameList(string prefixText, int count) { var arrItems = new string[0]; if (Security.USER_ID == Guid.Empty) { throw (new Exception("Authentication required")); } var oQuery = new InlineQueryDBManager(); oQuery.CommandText = ApplicationSQL.SQL["ProductCatalog_AutoComplete_212"].ToString(); CRMSecurity.Filter(oQuery, "ProductTemplates", "list"); TypeConvert.AppendParameter(oQuery, prefixText, CommonTypeConvert.SqlFilterMode.StartsWith, "NAME"); oQuery.CommandText += " order by NAME" + ControlChars.CrLf; using (DataTable dt = oQuery.GetTable()) { arrItems = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { arrItems[i] = CommonTypeConvert.ToString(dt.Rows[i]["NAME"]); } } return(arrItems); }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); string innerSql = " from vwINVOICES_List" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); Guid gACCOUNT_ID = CommonTypeConvert.ToGuid(Request["ACCOUNT_ID"]); if (!CommonTypeConvert.IsEmptyGuid(gACCOUNT_ID)) { TypeConvert.AppendParameter(oQuery, gACCOUNT_ID, "ACCOUNT_ID"); } oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + oQuery.CommandText + grdMain.OrderByClause(); using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); var oQuery = new InlineQueryDBManager(); string innerSql = " from vwPRODUCTS_List" + ControlChars.CrLf; oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); Guid gACCOUNT_ID = CommonTypeConvert.ToGuid(Request["ACCOUNT_ID"]); if (!CommonTypeConvert.IsEmptyGuid(gACCOUNT_ID)) { TypeConvert.AppendParameter(oQuery, gACCOUNT_ID, "ACCOUNT_ID"); } oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
public static DataTable ReportingModules() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwMODULES_Reporting_" + Security.USER_ID) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = "select MODULE_NAME " + ControlChars.CrLf + " , DISPLAY_NAME " + ControlChars.CrLf + " from vwMODULES_Reporting " + ControlChars.CrLf + " where USER_ID = @USER_ID " + ControlChars.CrLf + " or USER_ID is null " + ControlChars.CrLf; oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); foreach (DataRow row in dt.Rows) { row["DISPLAY_NAME"] = Translation.GetTranslation.Term(CommonTypeConvert.ToString(row["DISPLAY_NAME"])); } Cache.Insert("vwMODULES_Reporting_" + Security.USER_ID, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term("ProductCategories.LBL_LIST_FORM_TITLE")); Visible = Security.IS_ADMIN; Visible = Security.ADMIN_TYPE == 0 ? true : false; if (!Visible) { return; } var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["Administration_ProductCategories_ListView"].ToString(); oQuery.CommandText = innerSql; DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.SortColumn = "LIST_ORDER"; grdMain.SortOrder = "asc"; grdMain.ApplySort(); grdMain.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term("ProductTemplates.LBL_LIST_FORM_TITLE")); var oQuery = new InlineQueryDBManager(); string innerSql = " from vwPRODUCT_TEMPLATES_List" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; if (!IsPostBack) { new DynamicControl(ctlSearchView, "NAME").Text = CommonTypeConvert.ToString(Request["NAME"]); } grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
public static DataTable SavedSearch(string sMODULE) { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwSAVED_SEARCH." + sMODULE] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = "select ID " + ControlChars.CrLf + " , NAME " + ControlChars.CrLf + " , CONTENTS " + ControlChars.CrLf + " from vwSAVED_SEARCH " + ControlChars.CrLf + " where ASSIGNED_USER_ID = @USER_ID" + ControlChars.CrLf + " and SEARCH_MODULE = @MODULE " + ControlChars.CrLf + " order by NAME " + ControlChars.CrLf; oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); oQuery.Add("@MODULE", SqlDbType.VarChar, sMODULE); dt = oQuery.GetTable(); Session["vwSAVED_SEARCH." + sMODULE] = dt; } } return(dt); }
public static DataTable ActiveUsers() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwUSERS_List") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1149"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwUSERS_List", dt, null, DateTime.Now.AddSeconds(15), Cache.NoSlidingExpiration); } return dt; }
protected void BindGrid() { var oQuery = new InlineQueryDBManager(); string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwPRODUCT_TEMPLATES_PRODUCT_TEMPLATES" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "PRODUCT_TEMPLATE_ID"); oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc"); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; grdMain.DataBind(); }
public static DataTable ActiveUsers() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwUSERS_List") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1149"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwUSERS_List", dt, null, DateTime.Now.AddSeconds(15), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable TerminologyPickLists() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwTERMINOLOGY_PickList") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1177"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwTERMINOLOGY_PickList", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable Modules() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwMODULES") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1068"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwMODULES", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable InboundEmailMonitored(HttpApplicationState Application) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwINBOUND_EMAILS_Monitored") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_2063"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwINBOUND_EMAILS_Monitored", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable ReportingRelationships() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwRELATIONSHIPS_Reporting") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_448"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwRELATIONSHIPS_Reporting", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable ContractTypes() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwCONTRACT_TYPES_LISTBOX") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_908"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwCONTRACT_TYPES_LISTBOX", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void BindGrid() { var oQuery = new InlineQueryDBManager(); string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwPRODUCT_TEMPLATES_PRODUCT_TEMPLATES" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "PRODUCT_TEMPLATE_ID"); oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc"); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; grdMain.DataBind(); }
public static DataTable ProductCategories() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwPRODUCT_CATEGORIES_LISTBOX") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_716"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwPRODUCT_CATEGORIES_LISTBOX", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable FieldsMetaData_Validated(string sMODULE) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwFIELDS_META_DATA_Validated." + sMODULE) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1741"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@CUSTOM_MODULE", SqlDbType.VarChar, sMODULE); dt = oQuery.GetTable(); Cache.Insert("vwFIELDS_META_DATA_Validated." + sMODULE, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void BindGrid() { string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwINVOICES_PAYMENTS" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc"); using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; grdMain.DataBind(); } }
public static DataTable MobileMenu() { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwMODULES_MobileMenu_ByUser." + Security.USER_ID] as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1252"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); Session["vwMODULES_MobileMenu_ByUser." + Security.USER_ID] = dt; } return(dt); }
public static DataTable ReportingFilterColumns(string sMODULE_NAME) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwSqlColumns_Reporting." + sMODULE_NAME) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_491"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@OBJECTNAME", SqlDbType.VarChar, 100, "vw" + sMODULE_NAME); dt = oQuery.GetTable(); Cache.Insert("vwSqlColumns_Reporting." + sMODULE_NAME, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable FieldsMetaData_UnvalidatedCustomFields(string sTABLE_NAME) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwFIELDS_META_DATA_Unvalidated." + sTABLE_NAME) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1694"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@TABLE_NAME", SqlDbType.VarChar, sTABLE_NAME + "_CSTM"); dt = oQuery.GetTable(); Cache.Insert("vwFIELDS_META_DATA_Unvalidated." + sTABLE_NAME, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public string[] InvoiceNameList(string prefixText, int count) { var arrItems = new string[0]; if (Security.USER_ID == Guid.Empty) throw (new Exception("Authentication required")); var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["Invoices_AutoComplete_94"].ToString(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, "Invoices", "list"); TypeConvert.AppendParameter(oQuery, prefixText, CommonTypeConvert.SqlFilterMode.StartsWith, "NAME"); innerSql += " order by NAME" + ControlChars.CrLf; DataTable dt = oQuery.GetTable(); arrItems = new string[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) arrItems[i] = CommonTypeConvert.ToString(dt.Rows[i]["NAME"]); return arrItems; }
protected void BindGrid() { string innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwINVOICES_PAYMENTS" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID"); oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc"); using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; grdMain.DataBind(); } }
public static DataTable TimezonesListbox() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwTIMEZONES_LISTBOX") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = "select ID " + ControlChars.CrLf + " , NAME " + ControlChars.CrLf + " from vwTIMEZONES_LISTBOX" + ControlChars.CrLf + " order by BIAS desc " + ControlChars.CrLf; oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwTIMEZONES_LISTBOX", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
public static DataTable AssignedUser() { Cache Cache = HttpRuntime.Cache; bool bTeamFilter = !Security.IS_ADMIN && Config.enable_team_management(); string sCACHE_NAME = String.Empty; if (bTeamFilter) { sCACHE_NAME = "vwTEAMS_ASSIGNED_TO." + Security.USER_ID; } else { sCACHE_NAME = "vwUSERS_ASSIGNED_TO"; } var dt = Cache.Get(sCACHE_NAME) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql; if (bTeamFilter) { innerSql = ApplicationSQL.SQL["_code_CRMCache_256"].ToString(); } else { innerSql = "select ID " + ControlChars.CrLf + " , USER_NAME " + ControlChars.CrLf + " from vwUSERS_ASSIGNED_TO" + ControlChars.CrLf + " order by USER_NAME " + ControlChars.CrLf; } oQuery.CommandText = innerSql; if (bTeamFilter) { oQuery.Add("@MEMBERSHIP_USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); } dt = oQuery.GetTable(); Cache.Insert(sCACHE_NAME, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term("ProductTypes.LBL_LIST_FORM_TITLE")); if (!Visible) return; var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["Administration_ProductTypes_ListView"].ToString(); oQuery.CommandText = innerSql; DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.SortColumn = "LIST_ORDER"; grdMain.SortOrder = "asc"; grdMain.ApplySort(); grdMain.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { gID = CommonTypeConvert.ToGuid(Request["ID"]); string innerSql = ApplicationSQL.SQL["Invoices_LineItems"].ToString(); var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID", false); oQuery.CommandText += " order by POSITION asc" + ControlChars.CrLf; using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; { grdMain.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); var oQuery = new InlineQueryDBManager(); string innerSql = " from vwPRODUCT_TEMPLATES_List" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
protected void BindGrid() { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["Products_relatedProducts_58"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@ID", SqlDbType.UniqueIdentifier, gID); gACCOUNT_ID = CommonTypeConvert.ToGuid(oQuery.ExecuteScalar()); innerSql = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + " from vwPRODUCTS_RELATED_PRODUCTS" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "PARENT_ID"); oQuery.CommandText += grdMain.OrderByClause("DATE_ENTERED", "desc"); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; grdMain.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { gID = CommonTypeConvert.ToGuid(Request["ID"]); string innerSql = ApplicationSQL.SQL["Invoices_LineItems"].ToString(); var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "INVOICE_ID", false); oQuery.CommandText += " order by POSITION asc" + ControlChars.CrLf; using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; { grdMain.DataBind(); } } }
public static DataTable List(string sModuleName, string sListName) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get(Translation.GetTranslation.NAME + "." + sListName) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_177"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@MODULE_NAME", SqlDbType.NVarChar, sModuleName.ToLower()); oQuery.Add("@LIST_NAME", SqlDbType.NVarChar, sListName.ToLower()); oQuery.Add("@LANG", SqlDbType.NVarChar, Translation.GetTranslation.NAME.ToLower()); dt = oQuery.GetTable(); Cache.Insert(Translation.GetTranslation.NAME + "." + sListName, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["ProductCategories_Popup"].ToString(); oQuery.CommandText = innerSql; ctlSearch.SqlSearchClause(oQuery); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { if (String.IsNullOrEmpty(grdMain.SortColumn)) { grdMain.SortColumn = "LIST_ORDER"; grdMain.SortOrder = "asc"; } grdMain.ApplySort(); grdMain.DataBind(); } }
public static DataTable TabMenuDescription() { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwMODULES_DESCRIPTION_ByUser." + Security.USER_ID] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1939"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); Session["vwMODULES_DESCRIPTION_ByUser." + Security.USER_ID] = dt; } } return(dt); }
public static DataTable ImportModules() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwMODULES_Import_" + Security.USER_ID) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_RMCache_392"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); foreach (DataRow row in dt.Rows) { row["DISPLAY_NAME"] = Translation.GetTranslation.Term(CommonTypeConvert.ToString(row["DISPLAY_NAME"])); } Cache.Insert("vwMODULES_Import_" + Security.USER_ID, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return(dt); }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); string innerSql = " from vwPAYMENTS_List" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); grdMain.OrderByClause("PAYMENT_DATE", "desc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + CommonTypeConvert.FormatSelectFields(arrSelectFields) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); Visible = (Security.GetUserAccess(m_sMODULE, "list") >= 0); if (!Visible) { return; } if (IsMobile && grdMain.Columns.Count > 0) { grdMain.Columns[0].Visible = false; } string innerSql = " from vwINVOICES_List" + ControlChars.CrLf; var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + (Request.Form[ctlExportHeader.ExportUniqueID] != null ? "*" : CommonTypeConvert.FormatSelectFields(arrSelectFields)) + oQuery.CommandText + grdMain.OrderByClause(); using (DataTable dt = oQuery.GetTable()) { vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } } }
public static DataTable Shortcuts(string sMODULE_NAME) { var dt = HttpContext.Current.Session["vwSHORTCUTS_Menu_ByUser." + sMODULE_NAME + "." + Security.USER_ID] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1304"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@MODULE_NAME", SqlDbType.VarChar, 100, sMODULE_NAME); oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); HttpContext.Current.Session["vwSHORTCUTS_Menu_ByUser." + sMODULE_NAME + "." + Security.USER_ID] = dt; } } return(dt); }
public void LoadLineItems(Guid gID, Guid gACCOUNT_ID, Guid gDuplicateID, InlineQueryDBManager oQuery, SqlDataReader rdr) { this.gACCOUNT_ID = gACCOUNT_ID; if (!IsPostBack) { GetCurrencyControl(); CURRENCY_ID.SelectedValue = Currency.GetCurrency.ID.ToString(); EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString(); foreach (DataControlField col in grdMain.Columns) { if (!CommonTypeConvert.IsEmptyString(col.HeaderText)) { col.HeaderText = Translation.GetTranslation.Term(col.HeaderText); } var cf = col as CommandField; if (cf != null) { cf.EditText = Translation.GetTranslation.Term(cf.EditText); cf.DeleteText = Translation.GetTranslation.Term(cf.DeleteText); cf.UpdateText = Translation.GetTranslation.Term(cf.UpdateText); cf.CancelText = Translation.GetTranslation.Term(cf.CancelText); } } if ((!CommonTypeConvert.IsEmptyGuid(gID) || !CommonTypeConvert.IsEmptyGuid(gDuplicateID)) && (oQuery != null) && (rdr != null)) { CURRENCY_ID.SelectedValue = CommonTypeConvert.ToString(rdr["CURRENCY_ID"]); EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString(); float fEXCHANGE_RATE = CommonTypeConvert.ToFloat(rdr["EXCHANGE_RATE"]); if (fEXCHANGE_RATE == 0.0f) fEXCHANGE_RATE = 1.0f; EXCHANGE_RATE.Value = fEXCHANGE_RATE.ToString(); if (CURRENCY_ID.Items.Count > 0) { Guid gCURRENCY_ID = CommonTypeConvert.ToGuid(CURRENCY_ID.SelectedValue); SetCurrency(gCURRENCY_ID, fEXCHANGE_RATE); EXCHANGE_RATE.Value = Currency.GetCurrency.CONVERSION_RATE.ToString(); } ALLOCATED.Text = Currency.GetCurrency.ToCurrency(CommonTypeConvert.ToDecimal(rdr["TOTAL_ALLOCATED_USDOLLAR"])). ToString("c"); ALLOCATED_USDOLLAR.Value = CommonTypeConvert.ToDecimal(rdr["TOTAL_ALLOCATED_USDOLLAR"]).ToString("0.00"); rdr.Close(); string innerSql = ApplicationSQL.SQL["Payments_AllocationsView_233"].ToString(); oQuery.CommandText = innerSql; TypeConvert.AppendParameter(oQuery, gID, "PAYMENT_ID", false); oQuery.CommandText += " order by DATE_MODIFIED asc" + ControlChars.CrLf; DataTable dtLineItems = oQuery.GetTable(); if (!CommonTypeConvert.IsEmptyGuid(gDuplicateID)) { foreach (DataRow row in dtLineItems.Rows) { row["ID"] = Guid.NewGuid(); } } DataRow rowNew = dtLineItems.NewRow(); dtLineItems.Rows.Add(rowNew); ViewState["LineItems"] = dtLineItems; grdMain.DataSource = dtLineItems; grdMain.EditIndex = dtLineItems.Rows.Count - 1; grdMain.DataBind(); } else { dtLineItems = new DataTable(); var colID = new DataColumn("ID", Type.GetType("System.Guid")); var colINVOICE_NAME = new DataColumn("INVOICE_NAME", Type.GetType("System.String")); var colINVOICE_ID = new DataColumn("INVOICE_ID", Type.GetType("System.Guid")); var colAMOUNT_DUE = new DataColumn("AMOUNT_DUE", Type.GetType("System.Decimal")); var colAMOUNT_DUE_USDOLLAR = new DataColumn("AMOUNT_DUE_USDOLLAR", Type.GetType("System.Decimal")); var colAMOUNT = new DataColumn("AMOUNT", Type.GetType("System.Decimal")); var colAMOUNT_USDOLLAR = new DataColumn("AMOUNT_USDOLLAR", Type.GetType("System.Decimal")); dtLineItems.Columns.Add(colID); dtLineItems.Columns.Add(colINVOICE_NAME); dtLineItems.Columns.Add(colINVOICE_ID); dtLineItems.Columns.Add(colAMOUNT_DUE); dtLineItems.Columns.Add(colAMOUNT_DUE_USDOLLAR); dtLineItems.Columns.Add(colAMOUNT); dtLineItems.Columns.Add(colAMOUNT_USDOLLAR); DataRow rowNew = null; string innerSql = ApplicationSQL.SQL["Payments_AllocationsView"].ToString(); oQuery.CommandText = innerSql; Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]); TypeConvert.AppendParameter(oQuery, gPARENT_ID, "ID", false); using (SqlDataReader rdrInvoice = oQuery.ExecuteReader(CommandBehavior.SingleRow)) { if (rdrInvoice.Read()) { rowNew = dtLineItems.NewRow(); rowNew["INVOICE_NAME"] = CommonTypeConvert.ToString(rdrInvoice["NAME"]); rowNew["INVOICE_ID"] = CommonTypeConvert.ToGuid(rdrInvoice["ID"]); rowNew["AMOUNT_DUE"] = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE"]); rowNew["AMOUNT_DUE_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE_USDOLLAR"]); rowNew["AMOUNT"] = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE"]); rowNew["AMOUNT_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["AMOUNT_DUE_USDOLLAR"]); if (rdrInvoice["AMOUNT_DUE"] == DBNull.Value) { rowNew["AMOUNT_DUE"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL"]); rowNew["AMOUNT_DUE_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL_USDOLLAR"]); rowNew["AMOUNT"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL"]); rowNew["AMOUNT_USDOLLAR"] = CommonTypeConvert.ToDecimal(rdrInvoice["TOTAL_USDOLLAR"]); } dtLineItems.Rows.Add(rowNew); } } rowNew = dtLineItems.NewRow(); dtLineItems.Rows.Add(rowNew); ViewState["LineItems"] = dtLineItems; grdMain.DataSource = dtLineItems; grdMain.EditIndex = dtLineItems.Rows.Count - 1; grdMain.DataBind(); UpdateTotals(); } } }
public static DataTable SavedSearch(string sMODULE) { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwSAVED_SEARCH." + sMODULE] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = "select ID " + ControlChars.CrLf + " , NAME " + ControlChars.CrLf + " , CONTENTS " + ControlChars.CrLf + " from vwSAVED_SEARCH " + ControlChars.CrLf + " where ASSIGNED_USER_ID = @USER_ID" + ControlChars.CrLf + " and SEARCH_MODULE = @MODULE " + ControlChars.CrLf + " order by NAME " + ControlChars.CrLf; oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); oQuery.Add("@MODULE", SqlDbType.VarChar, sMODULE); dt = oQuery.GetTable(); Session["vwSAVED_SEARCH." + sMODULE] = dt; } } return dt; }
public static DataTable SearchColumns(string sVIEW_NAME) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwSqlColumns_Searching." + sVIEW_NAME) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1926"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@OBJECTNAME", SqlDbType.VarChar, sVIEW_NAME); dt = oQuery.GetTable(); Cache.Insert("vwSqlColumns_Searching." + sVIEW_NAME, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
protected void Page_Command(Object sender, CommandEventArgs e) { Guid gORDER_ID = CommonTypeConvert.ToGuid(Request["ORDER_ID"]); Guid gQUOTE_ID = CommonTypeConvert.ToGuid(Request["QUOTE_ID"]); Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]); string sMODULE = String.Empty; string sPARENT_TYPE = String.Empty; string sPARENT_NAME = String.Empty; CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME); if (e.CommandName == "Save") { ValidateEditViewFields(m_sMODULE + ".EditView"); ValidateEditViewFields(m_sMODULE + ".EditAddress"); ValidateEditViewFields(m_sMODULE + ".EditDescription"); if (Page.IsValid) { string sCUSTOM_MODULE = "INVOICES"; DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE); DataTable dtCustomLineItems = CRMCache.FieldsMetaData_UnvalidatedCustomFields(sCUSTOM_MODULE + "_LINE_ITEMS"); DataRow rowCurrent = null; var dtCurrent = new DataTable(); if (!CommonTypeConvert.IsEmptyGuid(gID)) { string innerSql = ApplicationSQL.SQL["Invoices_EditView_323"].ToString(); var oQuery = new InlineQueryDBManager(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "edit"); TypeConvert.AppendParameter(oQuery, gID, "ID", false); dtCurrent = oQuery.GetTable(); if (dtCurrent.Rows.Count > 0) { rowCurrent = dtCurrent.Rows[0]; } else { gID = Guid.Empty; } } ctlEditLineItemsView.UpdateTotals(); CommonProcedure.InvoicesUpdate (ref gID , new DynamicControl(this, rowCurrent, "ASSIGNED_USER_ID").ID , new DynamicControl(this, rowCurrent, "NAME").Text , new DynamicControl(this, rowCurrent, "QUOTE_ID").ID , new DynamicControl(this, rowCurrent, "ORDER_ID").ID , new DynamicControl(this, rowCurrent, "OPPORTUNITY_ID").ID , new DynamicControl(this, rowCurrent, "PAYMENT_TERMS").SelectedValue , new DynamicControl(this, rowCurrent, "INVOICE_STAGE").SelectedValue , new DynamicControl(this, rowCurrent, "PURCHASE_ORDER_NUM").Text , new DynamicControl(this, rowCurrent, "DUE_DATE").DateValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "EXCHANGE_RATE").FloatValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "CURRENCY_ID").ID , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TAXRATE_ID").ID , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SHIPPER_ID").ID , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SUBTOTAL").DecimalValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "DISCOUNT").DecimalValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "SHIPPING").DecimalValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TAX").DecimalValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "TOTAL").DecimalValue , new DynamicControl(ctlEditLineItemsView, rowCurrent, "AMOUNT_DUE").DecimalValue , new DynamicControl(this, rowCurrent, "BILLING_ACCOUNT_ID").ID , new DynamicControl(this, rowCurrent, "BILLING_CONTACT_ID").ID , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_STREET").Text , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_CITY").Text , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_STATE").Text , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_POSTALCODE").Text , new DynamicControl(this, rowCurrent, "BILLING_ADDRESS_COUNTRY").Text , new DynamicControl(this, rowCurrent, "SHIPPING_ACCOUNT_ID").ID , new DynamicControl(this, rowCurrent, "SHIPPING_CONTACT_ID").ID , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_STREET").Text , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_CITY").Text , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_STATE").Text , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_POSTALCODE").Text , new DynamicControl(this, rowCurrent, "SHIPPING_ADDRESS_COUNTRY").Text , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text , new DynamicControl(this, rowCurrent, "TEAM_ID").ID ); CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields); DataTable dtLineItems = ctlEditLineItemsView.LineItems; foreach (DataRow row in dtLineItems.Rows) { if (row.RowState == DataRowState.Deleted) { Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID", DataRowVersion.Original]); if (!CommonTypeConvert.IsEmptyGuid(gITEM_ID)) CommonProcedure.InvoicesLINE_ITEMS_Delete(gITEM_ID); } } int nPOSITION = 1; foreach (DataRow row in dtLineItems.Rows) { if (row.RowState != DataRowState.Deleted) { Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID"]); Guid gLINE_GROUP_ID = CommonTypeConvert.ToGuid(row["LINE_GROUP_ID"]); string sLINE_ITEM_TYPE = CommonTypeConvert.ToString(row["LINE_ITEM_TYPE"]); string sNAME = CommonTypeConvert.ToString(row["NAME"]); string sMFT_PART_NUM = CommonTypeConvert.ToString(row["MFT_PART_NUM"]); string sVENDOR_PART_NUM = CommonTypeConvert.ToString(row["VENDOR_PART_NUM"]); Guid gPRODUCT_TEMPLATE_ID = CommonTypeConvert.ToGuid(row["PRODUCT_TEMPLATE_ID"]); string sTAX_CLASS = CommonTypeConvert.ToString(row["TAX_CLASS"]); int nQUANTITY = CommonTypeConvert.ToInteger(row["QUANTITY"]); Decimal dCOST_PRICE = CommonTypeConvert.ToDecimal(row["COST_PRICE"]); Decimal dLIST_PRICE = CommonTypeConvert.ToDecimal(row["LIST_PRICE"]); Decimal dUNIT_PRICE = CommonTypeConvert.ToDecimal(row["UNIT_PRICE"]); string sDESCRIPTION = CommonTypeConvert.ToString(row["DESCRIPTION"]); if (!CommonTypeConvert.IsEmptyGuid(gPRODUCT_TEMPLATE_ID) || !CommonTypeConvert.IsEmptyString(sNAME)) { CommonProcedure.InvoicesLINE_ITEMS_Update (ref gITEM_ID , gID , gLINE_GROUP_ID , sLINE_ITEM_TYPE , nPOSITION , sNAME , sMFT_PART_NUM , sVENDOR_PART_NUM , gPRODUCT_TEMPLATE_ID , sTAX_CLASS , nQUANTITY , dCOST_PRICE , dLIST_PRICE , dUNIT_PRICE , sDESCRIPTION ); CRMDynamic.UpdateCustomFields(row, gITEM_ID, sCUSTOM_MODULE + "_LINE_ITEMS", dtCustomLineItems); nPOSITION++; } } } CommonProcedure.InvoicesUpdateAmountDue(gID); if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID)) Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID); else Response.Redirect("view.aspx?ID=" + gID); } } else if (e.CommandName == "Cancel") { if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID)) Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID); else if (!CommonTypeConvert.IsEmptyGuid(gORDER_ID)) Response.Redirect("~/CRM/Orders/view.aspx?ID=" + gORDER_ID); else if (!CommonTypeConvert.IsEmptyGuid(gQUOTE_ID)) Response.Redirect("~/CRM/Quotes/view.aspx?ID=" + gQUOTE_ID); else if (CommonTypeConvert.IsEmptyGuid(gID)) Response.Redirect("Index.aspx"); else Response.Redirect("view.aspx?ID=" + gID); } }
public static DataTable Shippers() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwSHIPPERS_LISTBOX") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_833"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwSHIPPERS_LISTBOX", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); Visible = (Security.GetUserAccess(m_sMODULE, "list") >= 0); if (!Visible) return; var oQuery = new InlineQueryDBManager(); string innerSql = " from vwPRODUCT_TEMPLATES_List" + ControlChars.CrLf + " where 1 = 1 " + ControlChars.CrLf; oQuery.CommandText = innerSql; int nACLACCESS = Security.GetUserAccess(m_sMODULE, "list"); if (nACLACCESS == ACL_ACCESS.OWNER) TypeConvert.AppendParameter(oQuery, Security.USER_ID, "ASSIGNED_USER_ID", false); grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + (Request.Form[ctlExportHeader.ExportUniqueID] != null ? "*" : CommonTypeConvert.FormatSelectFields(arrSelectFields)) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { SetPageTitle(Translation.GetTranslation.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE")); Visible = (Security.GetUserAccess(m_sMODULE, "list") >= 0); if (!Visible) return; if (IsMobile && grdMain.Columns.Count > 0) grdMain.Columns[0].Visible = false; var oQuery = new InlineQueryDBManager(); string innerSql = " from vwPRODUCTS_List" + ControlChars.CrLf; oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "list"); grdMain.OrderByClause("NAME", "asc"); ctlSearchView.SqlSearchClause(oQuery); oQuery.CommandText = "select " + (Request.Form[ctlExportHeader.ExportUniqueID] != null ? "*" : CommonTypeConvert.FormatSelectFields(arrSelectFields)) + oQuery.CommandText + grdMain.OrderByClause(); DataTable dt = oQuery.GetTable(); vwMain = dt.DefaultView; grdMain.DataSource = vwMain; if (!IsPostBack) { grdMain.DataBind(); } }
public static DataTable Shortcuts(string sMODULE_NAME) { var dt = HttpContext.Current.Session["vwSHORTCUTS_Menu_ByUser." + sMODULE_NAME + "." + Security.USER_ID] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1304"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@MODULE_NAME", SqlDbType.VarChar, 100, sMODULE_NAME); oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); HttpContext.Current.Session["vwSHORTCUTS_Menu_ByUser." + sMODULE_NAME + "." + Security.USER_ID] = dt; } } return dt; }
public static DataTable Languages(HttpApplicationState Application) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwLANGUAGES") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1028"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwLANGUAGES", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
public static DataTable ReportingModules() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwMODULES_Reporting_" + Security.USER_ID) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = "select MODULE_NAME " + ControlChars.CrLf + " , DISPLAY_NAME " + ControlChars.CrLf + " from vwMODULES_Reporting " + ControlChars.CrLf + " where USER_ID = @USER_ID " + ControlChars.CrLf + " or USER_ID is null " + ControlChars.CrLf; oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); foreach (DataRow row in dt.Rows) { row["DISPLAY_NAME"] = Translation.GetTranslation.Term(CommonTypeConvert.ToString(row["DISPLAY_NAME"])); } Cache.Insert("vwMODULES_Reporting_" + Security.USER_ID, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
public static DataTable List(string sModuleName, string sListName) { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get(Translation.GetTranslation.NAME + "." + sListName) as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_177"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@MODULE_NAME", SqlDbType.NVarChar, sModuleName.ToLower()); oQuery.Add("@LIST_NAME", SqlDbType.NVarChar, sListName.ToLower()); oQuery.Add("@LANG", SqlDbType.NVarChar, Translation.GetTranslation.NAME.ToLower()); dt = oQuery.GetTable(); Cache.Insert(Translation.GetTranslation.NAME + "." + sListName, dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
public static DataTable ReportingRelationships() { Cache Cache = HttpRuntime.Cache; var dt = Cache.Get("vwRELATIONSHIPS_Reporting") as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_448"].ToString(); oQuery.CommandText = innerSql; dt = oQuery.GetTable(); Cache.Insert("vwRELATIONSHIPS_Reporting", dt, null, DefaultCacheExpiration(), Cache.NoSlidingExpiration); } return dt; }
protected void Page_Command(Object sender, CommandEventArgs e) { Guid gPARENT_ID = CommonTypeConvert.ToGuid(Request["PARENT_ID"]); string sMODULE = String.Empty; string sPARENT_TYPE = String.Empty; string sPARENT_NAME = String.Empty; CommonProcedure.ParentGet(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME); if (e.CommandName == "Save") { var txtNAME = FindControl("NAME") as TextBox; var txtPRODUCT_TEMPLATE_ID = FindControl("PRODUCT_TEMPLATE_ID") as HtmlInputHidden; if (CommonTypeConvert.IsEmptyString(txtNAME.Text.Trim())) txtPRODUCT_TEMPLATE_ID.Value = String.Empty; else if (CommonTypeConvert.IsEmptyString(txtPRODUCT_TEMPLATE_ID.Value)) txtPRODUCT_TEMPLATE_ID.Value = Guid.Empty.ToString(); ValidateEditViewFields(m_sMODULE + ".EditView"); ValidateEditViewFields(m_sMODULE + ".CostView"); ValidateEditViewFields(m_sMODULE + ".MftView"); if (Page.IsValid) { string sCUSTOM_MODULE = "PRODUCTS"; DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE); var oQuery = new InlineQueryDBManager(); DataRow rowCurrent = null; if (!CommonTypeConvert.IsEmptyGuid(gID)) { string innerSql = ApplicationSQL.SQL["Products_EditView"].ToString(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "edit"); TypeConvert.AppendParameter(oQuery, gID, "ID", false); DataTable dtCurrent = oQuery.GetTable(); if (dtCurrent.Rows.Count > 0) { rowCurrent = dtCurrent.Rows[0]; } else { gID = Guid.Empty; } } CommonProcedure.ProductUpdate (ref gID , new DynamicControl(this, rowCurrent, "PRODUCT_TEMPLATE_ID").ID , new DynamicControl(this, rowCurrent, "NAME").Text , new DynamicControl(this, rowCurrent, "STATUS").SelectedValue , new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID , new DynamicControl(this, rowCurrent, "CONTACT_ID").ID , new DynamicControl(this, rowCurrent, "QUANTITY").IntegerValue , new DynamicControl(this, rowCurrent, "DATE_PURCHASED").DateValue , new DynamicControl(this, rowCurrent, "DATE_SUPPORT_EXPIRES").DateValue , new DynamicControl(this, rowCurrent, "DATE_SUPPORT_STARTS").DateValue , new DynamicControl(this, rowCurrent, "MANUFACTURER_ID").ID , new DynamicControl(this, rowCurrent, "CATEGORY_ID").ID , new DynamicControl(this, rowCurrent, "TYPE_ID").ID , new DynamicControl(this, rowCurrent, "WEBSITE").Text , new DynamicControl(this, rowCurrent, "MFT_PART_NUM").Text , new DynamicControl(this, rowCurrent, "VENDOR_PART_NUM").Text , new DynamicControl(this, rowCurrent, "SERIAL_NUMBER").Text , new DynamicControl(this, rowCurrent, "ASSET_NUMBER").Text , new DynamicControl(this, rowCurrent, "TAX_CLASS").SelectedValue , new DynamicControl(this, rowCurrent, "WEIGHT").FloatValue , new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID , new DynamicControl(this, rowCurrent, "COST_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "LIST_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "BOOK_VALUE").DecimalValue , new DynamicControl(this, rowCurrent, "BOOK_VALUE_DATE").DateValue , new DynamicControl(this, rowCurrent, "DISCOUNT_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "PRICING_FACTOR").IntegerValue , new DynamicControl(this, rowCurrent, "PRICING_FORMULA").SelectedValue , new DynamicControl(this, rowCurrent, "SUPPORT_NAME").Text , new DynamicControl(this, rowCurrent, "SUPPORT_CONTACT").Text , new DynamicControl(this, rowCurrent, "SUPPORT_DESCRIPTION").Text , new DynamicControl(this, rowCurrent, "SUPPORT_TERM").SelectedValue , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text , new DynamicControl(this, rowCurrent, "TEAM_ID").ID ); CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields); if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID)) Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID); else Response.Redirect("view.aspx?ID=" + gID); } } else if (e.CommandName == "Cancel") { if (!CommonTypeConvert.IsEmptyGuid(gPARENT_ID)) Response.Redirect("~/CRM/" + sMODULE + "/view.aspx?ID=" + gPARENT_ID); else if (CommonTypeConvert.IsEmptyGuid(gID)) Response.Redirect("Index.aspx"); else Response.Redirect("view.aspx?ID=" + gID); } }
public static DataTable List(string sListName) { DataTable dt = new DataTable(); if (sListName == "lead_status_dom") { InlineQueryDBManager oDbManager = new InlineQueryDBManager(); oDbManager.CommandText = "select * from LeadStatus"; oDbManager.CommandType = CommandType.Text; dt = oDbManager.GetTable(); } else if (sListName == "Currencies") { InlineQueryDBManager oDbManager = new InlineQueryDBManager(); oDbManager.CommandText = "select ID as [NAME],SYMBOL as DISPLAY_NAME from Currencies"; oDbManager.CommandType = CommandType.Text; dt = oDbManager.GetTable(); } else if (sListName == "program_plan") { InlineQueryDBManager oQuery; Guid User_ID = new Guid(HttpContext.Current.Session["USER_ID"].ToString()); oQuery = new InlineQueryDBManager(); oQuery.CommandText = "select distinct acl_roles.Name ROLE_NAME from acl_roles inner join acl_roles_users" + " on acl_roles.ID = role_id where user_id = '" + User_ID + "'"; oQuery.CommandType = CommandType.Text; DataTable oDataTable = oQuery.GetTable(); string Roles = ConfigurationManager.AppSettings["UserRoles_Channel_Partner"]; for (int i = 0; i < oDataTable.Rows.Count; i++) { if (oDataTable.Rows[i]["ROLE_NAME"].ToString() == Roles) { string User_Name = HttpContext.Current.Session["USER_NAME"].ToString(); oQuery = new InlineQueryDBManager(); oQuery.CommandText = "select * from vwProgramPlanSelection where [USER_NAME] = '" + HttpContext.Current.Session["USER_NAME"].ToString() + "'"; oQuery.CommandType = CommandType.Text; dt = oQuery.GetTable(); } } } else if (sListName == "reportsto_dom") { InlineQueryDBManager oQuery; Guid User_ID = new Guid(HttpContext.Current.Session["USER_ID"].ToString()); oQuery = new InlineQueryDBManager(); oQuery.CommandText = "select [USER_NAME] as [NAME],[USER_NAME] as [DISPLAY_NAME] from users" + " where ID = (select REPORTS_TO_ID from users where ID = '" + User_ID.ToString() + "' and DELETED = 0)"; oQuery.CommandType = CommandType.Text; dt = oQuery.GetTable(); } else if (sListName == "AssignedUser") { InlineQueryDBManager oDbManager = new InlineQueryDBManager(); string SQL = String.Format("select ID as NAME, IsNull(FIRST_NAME,'')+' '+IsNull(LAST_NAME,'') as DISPLAY_NAME from Users where ID IN (SELECT ID FROM fnSubordinates('{0}')) AND DELETED = 0",Security.USER_ID); oDbManager.CommandText = SQL; //oDbManager.CommandText = "select ID as NAME, IsNull(FIRST_NAME,'')+' '+IsNull(LAST_NAME,'') as DISPLAY_NAME from Users where DELETED = 0"; oDbManager.CommandType = CommandType.Text; dt = oDbManager.GetTable(); } else if (sListName == "Manufacturers") { InlineQueryDBManager oDbManager = new InlineQueryDBManager(); oDbManager.CommandText = "SELECT ID AS NAME,NAME AS DISPLAY_NAME from Manufacturers"; oDbManager.CommandType = CommandType.Text; dt = oDbManager.GetTable(); } else { string _XmlSchemaPath = HttpContext.Current.Server.MapPath("~/CRM/Resource/Schema/DropDownList.xsd"); string FileName = HttpContext.Current.Server.MapPath(String.Format("~/CRM/Resource/DropDownList/en-US/{0}.xml", sListName)); DataSet ds = new DataSet(); ds.ReadXmlSchema(_XmlSchemaPath); try { ds.ReadXml(FileName); dt = ds.Tables[1]; } catch { } } return dt; }
public static void AppendEditViewFields(DataView dvFields, HtmlTable tbl, System.Data.SqlClient.SqlDataReader rdr, CommandEventHandler Page_Command, bool bLayoutMode, string sEDIT_NAME) { bool bIsMobile = false; CRMPage Page = tbl.Page as CRMPage; if (Page != null) bIsMobile = Page.IsMobile; HtmlTableRow tr = null; int nRowIndex = tbl.Rows.Count - 1; int nColIndex = 0; HtmlTableCell tdLabel = null; HtmlTableCell tdField = null; if (bLayoutMode) tbl.Border = 1; if (dvFields.Count == 0 && tbl.Rows.Count <= 1) tbl.Visible = false; DataView vwSchema = null; if (rdr != null) vwSchema = new DataView(rdr.GetSchemaTable()); bool bEnableTeamManagement = Common.Config.enable_team_management(); bool bRequireTeamManagement = Common.Config.require_team_management(); bool bRequireUserAssignment = Common.Config.require_user_assignment(); HttpSessionState Session = HttpContext.Current.Session; foreach (DataRowView row in dvFields) { int gID = TypeConvert.ToInteger(row["ID"]); int nFIELD_INDEX = TypeConvert.ToInteger(row["FIELD_INDEX"]); string sFIELD_TYPE = TypeConvert.ToString(row["FIELD_TYPE"]); string sDATA_LABEL = TypeConvert.ToString(row["DATA_LABEL"]); string sDATA_FIELD = TypeConvert.ToString(row["DATA_FIELD"]); string sDISPLAY_FIELD = TypeConvert.ToString(row["DISPLAY_FIELD"]); string sCACHE_NAME = TypeConvert.ToString(row["CACHE_NAME"]); bool bDATA_REQUIRED = TypeConvert.ToBoolean(row["DATA_REQUIRED"]); bool bUI_REQUIRED = TypeConvert.ToBoolean(row["UI_REQUIRED"]); string sONCLICK_SCRIPT = TypeConvert.ToString(row["ONCLICK_SCRIPT"]); string sFORMAT_SCRIPT = TypeConvert.ToString(row["FORMAT_SCRIPT"]); short nFORMAT_TAB_INDEX = TypeConvert.ToShort(row["FORMAT_TAB_INDEX"]); int nFORMAT_MAX_LENGTH = TypeConvert.ToInteger(row["FORMAT_MAX_LENGTH"]); int nFORMAT_SIZE = TypeConvert.ToInteger(row["FORMAT_SIZE"]); int nFORMAT_ROWS = TypeConvert.ToInteger(row["FORMAT_ROWS"]); int nFORMAT_COLUMNS = TypeConvert.ToInteger(row["FORMAT_COLUMNS"]); int nCOLSPAN = TypeConvert.ToInteger(row["COLSPAN"]); int nROWSPAN = TypeConvert.ToInteger(row["ROWSPAN"]); string sLABEL_WIDTH = TypeConvert.ToString(row["LABEL_WIDTH"]); string sFIELD_WIDTH = TypeConvert.ToString(row["FIELD_WIDTH"]); int nDATA_COLUMNS = TypeConvert.ToInteger(row["DATA_COLUMNS"]); string sFIELD_VALIDATOR_MESSAGE = TypeConvert.ToString(row["FIELD_VALIDATOR_MESSAGE"]); string sVALIDATION_TYPE = TypeConvert.ToString(row["VALIDATION_TYPE"]); string sREGULAR_EXPRESSION = TypeConvert.ToString(row["REGULAR_EXPRESSION"]); string sDATA_TYPE = TypeConvert.ToString(row["DATA_TYPE"]); string sMININUM_VALUE = TypeConvert.ToString(row["MININUM_VALUE"]); string sMAXIMUM_VALUE = TypeConvert.ToString(row["MAXIMUM_VALUE"]); string sCOMPARE_OPERATOR = TypeConvert.ToString(row["COMPARE_OPERATOR"]); if (nDATA_COLUMNS == 0) nDATA_COLUMNS = 2; if (!bLayoutMode && sDATA_FIELD == "TEAM_ID") { if (!bEnableTeamManagement) { sFIELD_TYPE = "Blank"; bUI_REQUIRED = false; } else { if (bRequireTeamManagement) bUI_REQUIRED = true; } } if (!bLayoutMode && sDATA_FIELD == "ASSIGNED_USER_ID") { if (bRequireUserAssignment) bUI_REQUIRED = true; } if (bIsMobile && String.Compare(sFIELD_TYPE, "AddressButtons", true) == 0) { continue; } if ((nCOLSPAN >= 0 && nColIndex == 0) || tr == null || bIsMobile) { nRowIndex++; tr = new HtmlTableRow(); tbl.Rows.Insert(nRowIndex, tr); } if (bLayoutMode) { HtmlTableCell tdAction = new HtmlTableCell(); tr.Cells.Add(tdAction); tdAction.Attributes.Add("class", "tabDetailViewDL"); tdAction.NoWrap = true; Literal litIndex = new Literal(); tdAction.Controls.Add(litIndex); litIndex.Text = " " + nFIELD_INDEX.ToString() + " "; ImageButton btnMoveUp = CreateLayoutImageButtonSkin(gID, "Layout.MoveUp", nFIELD_INDEX, Translation.GetTranslation.Term("Dropdown.LNK_UP"), "uparrow_inline", Page_Command); ImageButton btnMoveDown = CreateLayoutImageButtonSkin(gID, "Layout.MoveDown", nFIELD_INDEX, Translation.GetTranslation.Term("Dropdown.LNK_DOWN"), "downarrow_inline", Page_Command); ImageButton btnInsert = CreateLayoutImageButtonSkin(gID, "Layout.Insert", nFIELD_INDEX, Translation.GetTranslation.Term("Dropdown.LNK_INS"), "plus_inline", Page_Command); ImageButton btnEdit = CreateLayoutImageButtonSkin(gID, "Layout.Edit", nFIELD_INDEX, Translation.GetTranslation.Term("Dropdown.LNK_EDIT"), "edit_inline", Page_Command); ImageButton btnDelete = CreateLayoutImageButtonSkin(gID, "Layout.Delete", nFIELD_INDEX, Translation.GetTranslation.Term("Dropdown.LNK_DELETE"), "delete_inline", Page_Command); tdAction.Controls.Add(btnMoveUp); tdAction.Controls.Add(btnMoveDown); tdAction.Controls.Add(btnInsert); tdAction.Controls.Add(btnEdit); tdAction.Controls.Add(btnDelete); } Literal litLabel = new Literal(); if (!TypeConvert.IsEmptyString(sDATA_FIELD)) litLabel.ID = sDATA_FIELD + "_LABEL"; if (nCOLSPAN >= 0 || tdLabel == null || tdField == null) { tdLabel = new HtmlTableCell(); tdField = new HtmlTableCell(); tr.Cells.Add(tdLabel); tr.Cells.Add(tdField); if (nCOLSPAN > 0) { tdField.ColSpan = nCOLSPAN; if (bLayoutMode) tdField.ColSpan++; } tdLabel.Attributes.Add("class", "dataLabel"); tdLabel.VAlign = "top"; tdLabel.Width = sLABEL_WIDTH; tdField.Attributes.Add("class", "dataField"); tdField.VAlign = "top"; if (nCOLSPAN == 0) tdField.Width = sFIELD_WIDTH; tdLabel.Controls.Add(litLabel); if (bLayoutMode) litLabel.Text = sDATA_LABEL; else if (sDATA_LABEL.IndexOf(".") >= 0) litLabel.Text = Translation.GetTranslation.Term(sDATA_LABEL); else if (!TypeConvert.IsEmptyString(sDATA_LABEL) && rdr != null) { litLabel.Text = sDATA_LABEL; if (vwSchema != null) { vwSchema.RowFilter = "ColumnName = '" + TypeConvert.EscapeSQL(sDATA_LABEL) + "'"; if (vwSchema.Count > 0) litLabel.Text = TypeConvert.ToString(rdr[sDATA_LABEL]) + Translation.GetTranslation.Term("Calls.LBL_COLON"); } } else litLabel.Text = sDATA_LABEL; // " "; if (!bLayoutMode && bUI_REQUIRED) { Label lblRequired = new Label(); tdLabel.Controls.Add(lblRequired); lblRequired.CssClass = "required"; lblRequired.Text = Translation.GetTranslation.Term(".LBL_REQUIRED_SYMBOL"); } } if (String.Compare(sFIELD_TYPE, "Blank", true) == 0) { Literal litField = new Literal(); tdField.Controls.Add(litField); if (bLayoutMode) { litLabel.Text = "*** BLANK ***"; litField.Text = "*** BLANK ***"; } else { litLabel.Text = " "; litField.Text = " "; } } else if (String.Compare(sFIELD_TYPE, "Label", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { Literal litField = new Literal(); tdField.Controls.Add(litField); tdField.VAlign = "middle"; litField.ID = sDATA_FIELD; if (bLayoutMode) litField.Text = sDATA_FIELD; else if (sDATA_FIELD.IndexOf(".") >= 0) litField.Text = Translation.GetTranslation.Term(sDATA_FIELD); else if (rdr != null) litField.Text = TypeConvert.ToString(rdr[sDATA_FIELD]); } } else if (String.Compare(sFIELD_TYPE, "ListBox", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { ListControl lstField = null; if (nFORMAT_ROWS > 0) { ListBox lb = new ListBox(); lb.SelectionMode = ListSelectionMode.Multiple; lb.Rows = nFORMAT_ROWS; lstField = lb; } else { lstField = new KeySortDropDownList(); } tdField.Controls.Add(lstField); lstField.ID = sDATA_FIELD; lstField.TabIndex = nFORMAT_TAB_INDEX; if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { if (!TypeConvert.IsEmptyString(sCACHE_NAME) && (bLayoutMode || !tbl.Page.IsPostBack)) { lstField.DataValueField = "NAME"; lstField.DataTextField = "DISPLAY_NAME"; lstField.DataSource = CRMCache.List(sCACHE_NAME); if (sCACHE_NAME != "lead_status_dom") { if (sCACHE_NAME != "Currencies") { lstField.Attributes.Add("class", "dropdown"); } } if (sCACHE_NAME != "program_plan" || sCACHE_NAME != "Currencies") { if (sCACHE_NAME != "Currencies") { lstField.Attributes.Add("dom", sCACHE_NAME); } } lstField.DataBind(); if (!TypeConvert.IsEmptyString(sONCLICK_SCRIPT)) lstField.Attributes.Add("onchange", sONCLICK_SCRIPT); if (!bUI_REQUIRED) { lstField.Items.Insert(0, new ListItem(Translation.GetTranslation.Term(".LBL_NONE"), "")); lstField.DataBound += new EventHandler(ListControl_DataBound_AllowNull); } } if (rdr != null) { string sVALUE = TypeConvert.ToString(rdr[sDATA_FIELD]); if (nFORMAT_ROWS > 0 && sVALUE.StartsWith("<?xml")) { XmlDocument xml = new XmlDocument(); xml.LoadXml(sVALUE); XmlNodeList nlValues = xml.DocumentElement.SelectNodes("Value"); foreach (XmlNode xValue in nlValues) { foreach (ListItem item in lstField.Items) { if (item.Value == xValue.InnerText) item.Selected = true; } } } else { lstField.SelectedValue = sVALUE; } } else if (rdr == null && !tbl.Page.IsPostBack && sCACHE_NAME == "AssignedUser") { if (nFORMAT_ROWS == 0) lstField.SelectedValue = CRMSecurity.USER_ID.ToString(); } } if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "CheckBox", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { CheckBox chkField = new CheckBox(); tdField.Controls.Add(chkField); chkField.ID = sDATA_FIELD; chkField.CssClass = "checkbox"; chkField.TabIndex = nFORMAT_TAB_INDEX; if (rdr != null) chkField.Checked = TypeConvert.ToBoolean(rdr[sDATA_FIELD]); if (!TypeConvert.IsEmptyString(sONCLICK_SCRIPT)) chkField.Attributes.Add("onclick", sONCLICK_SCRIPT); if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); chkField.Enabled = false; } } } else if (String.Compare(sFIELD_TYPE, "ChangeButton", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { if (sDATA_LABEL == "PARENT_TYPE") { tdLabel.Controls.Clear(); DropDownList lstField = new KeySortDropDownList(); tdLabel.Controls.Add(lstField); lstField.ID = sDATA_LABEL; lstField.TabIndex = nFORMAT_TAB_INDEX; lstField.Attributes.Add("onChange", "ChangeParentType();"); if (bLayoutMode || !tbl.Page.IsPostBack) { lstField.DataValueField = "NAME"; lstField.DataTextField = "DISPLAY_NAME"; lstField.DataSource = CRMCache.List("record_type_display"); lstField.DataBind(); if (rdr != null) { lstField.ClearSelection(); lstField.SelectedValue = TypeConvert.ToString(rdr[sDATA_LABEL]); } } } TextBox txtNAME = new TextBox(); tdField.Controls.Add(txtNAME); txtNAME.ID = sDISPLAY_FIELD; txtNAME.ReadOnly = true; txtNAME.TabIndex = nFORMAT_TAB_INDEX; txtNAME.EnableViewState = false; if (bLayoutMode) { txtNAME.Text = sDISPLAY_FIELD; txtNAME.Enabled = false; } else if (tbl.Page.IsPostBack) { if (tbl.Page.Request[txtNAME.UniqueID] != null) txtNAME.Text = TypeConvert.ToString(tbl.Page.Request[txtNAME.UniqueID]); } else if (!TypeConvert.IsEmptyString(sDISPLAY_FIELD) && rdr != null) txtNAME.Text = TypeConvert.ToString(rdr[sDISPLAY_FIELD]); else if (sDATA_FIELD == "TEAM_ID" && rdr == null && !tbl.Page.IsPostBack) txtNAME.Text = CRMSecurity.TEAM_NAME; else if (sDATA_FIELD == "ASSIGNED_USER_ID" && rdr == null && !tbl.Page.IsPostBack) txtNAME.Text = CRMSecurity.USER_NAME; HtmlInputHidden hidID = new HtmlInputHidden(); tdField.Controls.Add(hidID); hidID.ID = sDATA_FIELD; if (!bLayoutMode) { if (!TypeConvert.IsEmptyString(sDATA_FIELD) && rdr != null) { hidID.Value = TypeConvert.ToString(rdr[sDATA_FIELD]); hidID.Value = (TypeConvert.ToGuid(hidID.Value) == Guid.Empty) ? "" : hidID.Value; } else if (sDATA_FIELD == "TEAM_ID" && rdr == null && !tbl.Page.IsPostBack) hidID.Value = CRMSecurity.TEAM_ID.ToString(); else if (sDATA_FIELD == "ASSIGNED_USER_ID" && rdr == null && !tbl.Page.IsPostBack) hidID.Value = CRMSecurity.USER_ID.ToString(); } if (!String.IsNullOrEmpty(CRMSecurity.TEAM_NAME)) { txtNAME.Text = CRMSecurity.TEAM_NAME; } else { InlineQueryDBManager oQuery = new InlineQueryDBManager(); oQuery.CommandText = "select Teams.name,Teams.id from Teams where id in (select t.team_ID from users u " + "inner join Team_Memberships t on u.id = t.USER_ID " + "and u.id ='" + Security.USER_ID.ToString() + "')"; using (DataTable dt = oQuery.GetTable()) { if (dt.Rows.Count > 0 && (sDATA_FIELD != "ASSIGNED_USER_ID" && rdr == null && !tbl.Page.IsPostBack)) { txtNAME.Text = dt.Rows[0]["name"].ToString(); hidID.Value = dt.Rows[0]["id"].ToString(); } } } Literal litNBSP = new Literal(); tdField.Controls.Add(litNBSP); litNBSP.Text = " "; HtmlInputButton btnChange = new HtmlInputButton("button"); tdField.Controls.Add(btnChange); btnChange.ID = sDATA_FIELD + "_btnChange"; btnChange.Attributes.Add("class", "button"); if (!TypeConvert.IsEmptyString(sONCLICK_SCRIPT)) btnChange.Attributes.Add("onclick", sONCLICK_SCRIPT); btnChange.Attributes.Add("title", Translation.GetTranslation.Term(".LBL_SELECT_BUTTON_TITLE")); btnChange.Value = Translation.GetTranslation.Term(".LBL_SELECT_BUTTON_LABEL"); if (sONCLICK_SCRIPT.IndexOf("Popup();") > 0) { litNBSP = new Literal(); tdField.Controls.Add(litNBSP); litNBSP.Text = " "; HtmlInputButton btnClear = new HtmlInputButton("button"); tdField.Controls.Add(btnClear); btnClear.ID = sDATA_FIELD + "_btnClear"; btnClear.Attributes.Add("class", "button"); btnClear.Attributes.Add("onclick", sONCLICK_SCRIPT.Replace("Popup();", "('', '');").Replace("return ", "return Change")); btnClear.Attributes.Add("title", Translation.GetTranslation.Term(".LBL_CLEAR_BUTTON_TITLE")); btnClear.Value = Translation.GetTranslation.Term(".LBL_CLEAR_BUTTON_LABEL"); } if (!bLayoutMode && bUI_REQUIRED && !TypeConvert.IsEmptyString(sDATA_FIELD)) { RequiredFieldValidatorForHiddenInputs reqID = new RequiredFieldValidatorForHiddenInputs(); reqID.ID = sDATA_FIELD + "_REQUIRED"; reqID.ControlToValidate = hidID.ID; reqID.ErrorMessage = Translation.GetTranslation.Term(".ERR_REQUIRED_FIELD"); reqID.CssClass = "required"; reqID.EnableViewState = false; reqID.EnableClientScript = false; reqID.Enabled = false; reqID.Style.Add("padding-left", "4px"); tdField.Controls.Add(reqID); } } } else if (String.Compare(sFIELD_TYPE, "TextBox", true) == 0 || String.Compare(sFIELD_TYPE, "Password", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { TextBox txtField = new TextBox(); tdField.Controls.Add(txtField); txtField.ID = sDATA_FIELD; txtField.TabIndex = nFORMAT_TAB_INDEX; if (nFORMAT_ROWS > 0 && nFORMAT_COLUMNS > 0) { txtField.Rows = nFORMAT_ROWS; txtField.Columns = nFORMAT_COLUMNS; txtField.TextMode = TextBoxMode.MultiLine; } else { txtField.MaxLength = nFORMAT_MAX_LENGTH; txtField.Attributes.Add("size", nFORMAT_SIZE.ToString()); txtField.TextMode = TextBoxMode.SingleLine; } if (bLayoutMode) { txtField.Text = sDATA_FIELD; txtField.ReadOnly = true; } else if (!TypeConvert.IsEmptyString(sDATA_FIELD) && rdr != null) { int nOrdinal = rdr.GetOrdinal(sDATA_FIELD); string sTypeName = rdr.GetDataTypeName(nOrdinal); if (sTypeName == "money" || rdr[sDATA_FIELD].GetType() == typeof(System.Decimal)) txtField.Text = TypeConvert.ToDecimal(rdr[sDATA_FIELD]).ToString("#,##0.00"); else txtField.Text = TypeConvert.ToString(rdr[sDATA_FIELD]); } if (String.Compare(sFIELD_TYPE, "Password", true) == 0) txtField.TextMode = TextBoxMode.Password; if (!bLayoutMode && bUI_REQUIRED && !TypeConvert.IsEmptyString(sDATA_FIELD)) { RequiredFieldValidator reqNAME = new RequiredFieldValidator(); reqNAME.ID = sDATA_FIELD + "_REQUIRED"; reqNAME.ControlToValidate = txtField.ID; reqNAME.ErrorMessage = Translation.GetTranslation.Term(".ERR_REQUIRED_FIELD"); reqNAME.CssClass = "required"; reqNAME.EnableViewState = false; reqNAME.EnableClientScript = false; reqNAME.Enabled = false; reqNAME.Style.Add("padding-left", "4px"); tdField.Controls.Add(reqNAME); } if (!bLayoutMode && !TypeConvert.IsEmptyString(sDATA_FIELD)) { if (sVALIDATION_TYPE == "RegularExpressionValidator" && !TypeConvert.IsEmptyString(sREGULAR_EXPRESSION) && !TypeConvert.IsEmptyString(sFIELD_VALIDATOR_MESSAGE)) { RegularExpressionValidator reqVALIDATOR = new RegularExpressionValidator(); reqVALIDATOR.ID = sDATA_FIELD + "_VALIDATOR"; reqVALIDATOR.ControlToValidate = txtField.ID; reqVALIDATOR.ErrorMessage = Translation.GetTranslation.Term(sFIELD_VALIDATOR_MESSAGE); reqVALIDATOR.ValidationExpression = sREGULAR_EXPRESSION; reqVALIDATOR.CssClass = "required"; reqVALIDATOR.EnableViewState = false; reqVALIDATOR.EnableClientScript = false; reqVALIDATOR.Enabled = false; reqVALIDATOR.Style.Add("padding-left", "4px"); tdField.Controls.Add(reqVALIDATOR); } } } } else if (String.Compare(sFIELD_TYPE, "DatePicker", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { DatePicker ctlDate = tbl.Page.LoadControl("~/CRM/UserControls/DatePicker.ascx") as DatePicker; tdField.Controls.Add(ctlDate); ctlDate.ID = sDATA_FIELD; ctlDate.TabIndex = nFORMAT_TAB_INDEX; if (rdr != null) ctlDate.Value = CRM.Common.TimeZone.GetTimeZone.FromServerTime(rdr[sDATA_FIELD]); if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "DateRange", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { Table tblDateRange = new Table(); tdField.Controls.Add(tblDateRange); TableRow trAfter = new TableRow(); TableRow trBefore = new TableRow(); tblDateRange.Rows.Add(trAfter); tblDateRange.Rows.Add(trBefore); TableCell tdAfterLabel = new TableCell(); TableCell tdAfterData = new TableCell(); TableCell tdBeforeLabel = new TableCell(); TableCell tdBeforeData = new TableCell(); trAfter.Cells.Add(tdAfterLabel); trAfter.Cells.Add(tdAfterData); trBefore.Cells.Add(tdBeforeLabel); trBefore.Cells.Add(tdBeforeData); DatePicker ctlDateStart = tbl.Page.LoadControl("~/CRM/UserControls/DatePicker.ascx") as DatePicker; DatePicker ctlDateEnd = tbl.Page.LoadControl("~/CRM/UserControls/DatePicker.ascx") as DatePicker; Literal litAfterLabel = new Literal(); Literal litBeforeLabel = new Literal(); litAfterLabel.Text = Translation.GetTranslation.Term("SavedSearch.LBL_SEARCH_AFTER"); litBeforeLabel.Text = Translation.GetTranslation.Term("SavedSearch.LBL_SEARCH_BEFORE"); tdAfterLabel.Controls.Add(litAfterLabel); tdAfterData.Controls.Add(ctlDateStart); tdBeforeLabel.Controls.Add(litBeforeLabel); tdBeforeData.Controls.Add(ctlDateEnd); ctlDateStart.ID = sDATA_FIELD + "_AFTER"; ctlDateEnd.ID = sDATA_FIELD + "_BEFORE"; ctlDateStart.TabIndex = nFORMAT_TAB_INDEX; ctlDateEnd.TabIndex = nFORMAT_TAB_INDEX; if (rdr != null) { ctlDateStart.Value = CRM.Common.TimeZone.GetTimeZone.FromServerTime(rdr[sDATA_FIELD]); ctlDateEnd.Value = CRM.Common.TimeZone.GetTimeZone.FromServerTime(rdr[sDATA_FIELD]); } if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "DateTimePicker", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { DateTimePicker ctlDate = tbl.Page.LoadControl("~/CRM/UserControls/DateTimePicker.ascx") as DateTimePicker; tdField.Controls.Add(ctlDate); ctlDate.ID = sDATA_FIELD; ctlDate.TabIndex = nFORMAT_TAB_INDEX; if (rdr != null) ctlDate.Value = CRM.Common.TimeZone.GetTimeZone.FromServerTime(rdr[sDATA_FIELD]); if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "DateTimeEdit", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { DateTimeEdit ctlDate = tbl.Page.LoadControl("~/CRM/UserControls/DateTimeEdit.ascx") as DateTimeEdit; tdField.Controls.Add(ctlDate); ctlDate.ID = sDATA_FIELD; ctlDate.TabIndex = nFORMAT_TAB_INDEX; if (rdr != null) ctlDate.Value = CRM.Common.TimeZone.GetTimeZone.FromServerTime(rdr[sDATA_FIELD]); if (!bLayoutMode && bUI_REQUIRED) { ctlDate.EnableNone = false; } if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "File", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { HtmlInputFile ctlField = new HtmlInputFile(); tdField.Controls.Add(ctlField); ctlField.ID = sDATA_FIELD; ctlField.MaxLength = nFORMAT_MAX_LENGTH; ctlField.Size = nFORMAT_SIZE; ctlField.Attributes.Add("TabIndex", nFORMAT_TAB_INDEX.ToString()); if (!bLayoutMode && bUI_REQUIRED) { RequiredFieldValidator reqNAME = new RequiredFieldValidator(); reqNAME.ID = sDATA_FIELD + "_REQUIRED"; reqNAME.ControlToValidate = ctlField.ID; reqNAME.ErrorMessage = Translation.GetTranslation.Term(".ERR_REQUIRED_FIELD"); reqNAME.CssClass = "required"; reqNAME.EnableViewState = false; reqNAME.EnableClientScript = false; reqNAME.Enabled = false; reqNAME.Style.Add("padding-left", "4px"); tdField.Controls.Add(reqNAME); } } } else if (String.Compare(sFIELD_TYPE, "Image", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { HtmlInputHidden ctlHidden = new HtmlInputHidden(); if (!bLayoutMode) { tdField.Controls.Add(ctlHidden); ctlHidden.ID = sDATA_FIELD; HtmlInputFile ctlField = new HtmlInputFile(); tdField.Controls.Add(ctlField); ctlField.ID = sDATA_FIELD + "_File"; Literal litBR = new Literal(); litBR.Text = "<br />"; tdField.Controls.Add(litBR); } Image imgField = new Image(); imgField.ID = "img" + sDATA_FIELD; try { if (bLayoutMode) { Literal litField = new Literal(); litField.Text = sDATA_FIELD; tdField.Controls.Add(litField); } else if (rdr != null) { if (!TypeConvert.IsEmptyString(rdr[sDATA_FIELD])) { ctlHidden.Value = TypeConvert.ToString(rdr[sDATA_FIELD]); imgField.ImageUrl = "~/CRM/Images/Image.aspx?ID=" + ctlHidden.Value; tdField.Controls.Add(imgField); Literal litClear = new Literal(); litClear.Text = "<br /><input type=\"button\" class=\"button\" onclick=\"form." + ctlHidden.ClientID + ".value='';form." + imgField.ClientID + ".src='';" + "\" value='" + " " + Translation.GetTranslation.Term(".LBL_CLEAR_BUTTON_LABEL") + " " + "' title='" + Translation.GetTranslation.Term(".LBL_CLEAR_BUTTON_TITLE") + "' />"; tdField.Controls.Add(litClear); } } } catch (Exception ex) { Literal litField = new Literal(); litField.Text = ex.Message; tdField.Controls.Add(litField); } } } else if (String.Compare(sFIELD_TYPE, "AddressButtons", true) == 0) { tr.Cells.Remove(tdField); tdLabel.Width = "10%"; tdLabel.RowSpan = nROWSPAN; tdLabel.VAlign = "middle"; tdLabel.Align = "center"; tdLabel.Attributes.Remove("class"); tdLabel.Attributes.Add("class", "tabFormAddDel"); HtmlInputButton btnCopyRight = new HtmlInputButton("button"); Literal litSpacer = new Literal(); HtmlInputButton btnCopyLeft = new HtmlInputButton("button"); tdLabel.Controls.Add(btnCopyRight); tdLabel.Controls.Add(litSpacer); tdLabel.Controls.Add(btnCopyLeft); btnCopyRight.Attributes.Add("title", Translation.GetTranslation.Term("Accounts.NTC_COPY_BILLING_ADDRESS")); btnCopyRight.Attributes.Add("onclick", "return copyAddressRight()"); btnCopyRight.Value = ">>"; litSpacer.Text = "<br><br>"; btnCopyLeft.Attributes.Add("title", Translation.GetTranslation.Term("Accounts.NTC_COPY_SHIPPING_ADDRESS")); btnCopyLeft.Attributes.Add("onclick", "return copyAddressLeft()"); btnCopyLeft.Value = "<<"; nColIndex = 0; } else if (String.Compare(sFIELD_TYPE, "Hidden", true) == 0) { if (!TypeConvert.IsEmptyString(sDATA_FIELD)) { HtmlInputHidden hidID = new HtmlInputHidden(); tdField.Controls.Add(hidID); hidID.ID = sDATA_FIELD; if (bLayoutMode) { TextBox txtNAME = new TextBox(); tdField.Controls.Add(txtNAME); txtNAME.ReadOnly = true; txtNAME.EnableViewState = false; txtNAME.Text = sDATA_FIELD; txtNAME.Enabled = false; } else { nCOLSPAN = -1; tr.Cells.Remove(tdLabel); tdField.Attributes.Add("style", "display:none"); if (!TypeConvert.IsEmptyString(sDATA_FIELD) && rdr != null) hidID.Value = TypeConvert.ToString(rdr[sDATA_FIELD]); else if (sDATA_FIELD == "TEAM_ID" && rdr == null && !tbl.Page.IsPostBack) hidID.Value = CRMSecurity.TEAM_ID.ToString(); else if (sDATA_FIELD == "ASSIGNED_USER_ID" && rdr == null && !tbl.Page.IsPostBack) hidID.Value = CRMSecurity.USER_ID.ToString(); } } } else { Literal litField = new Literal(); tdField.Controls.Add(litField); litField.Text = "Unknown field type " + sFIELD_TYPE; } if (nCOLSPAN > 0) nColIndex += nCOLSPAN; else if (nCOLSPAN == 0) nColIndex++; if (nColIndex >= nDATA_COLUMNS) nColIndex = 0; } }
protected void Page_Command(Object sender, CommandEventArgs e) { if (e.CommandName == "Save" || e.CommandName == "Charge") { ValidateEditViewFields(m_sMODULE + ".EditView"); bool bIsValid = Page.IsValid; Decimal dAMOUNT = new DynamicControl(this, "AMOUNT").DecimalValue; if (dAMOUNT != ctlAllocationsView.ALLOCATED_TOTAL) { ctlDynamicButtons.ErrorText = Translation.GetTranslation.Term("Payments.ERR_AMOUNT_MUST_MATCH_ALLOCATION"); bIsValid = false; } if (bIsValid) { string sCUSTOM_MODULE = "PAYMENTS"; DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE); var oQuery = new InlineQueryDBManager(); DataRow rowCurrent = null; if (!CommonTypeConvert.IsEmptyGuid(gID)) { string innerSql = ApplicationSQL.SQL["Payments_EditView_259"].ToString(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "edit"); TypeConvert.AppendParameter(oQuery, gID, "ID", false); DataTable dtCurrent = oQuery.GetTable(); if (dtCurrent.Rows.Count > 0) { rowCurrent = dtCurrent.Rows[0]; } else { gID = Guid.Empty; } } Guid gASSIGNED_USER_ID = new DynamicControl(this, rowCurrent, "ASSIGNED_USER_ID").ID; Guid gACCOUNT_ID = new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID; DateTime dtPAYMENT_DATE = new DynamicControl(this, rowCurrent, "PAYMENT_DATE").DateValue; string sPAYMENT_TYPE = new DynamicControl(this, rowCurrent, "PAYMENT_TYPE").SelectedValue; string sCUSTOMER_REFERENCE = new DynamicControl(this, rowCurrent, "CUSTOMER_REFERENCE").Text; Guid gCURRENCY_ID = new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID; string sDESCRIPTION = new DynamicControl(this, rowCurrent, "DESCRIPTION").Text; Guid gTEAM_ID = new DynamicControl(this, rowCurrent, "TEAM_ID").ID; Guid gCREDIT_CARD_ID = new DynamicControl(this, rowCurrent, "CREDIT_CARD_ID").ID; if (sPAYMENT_TYPE != "Credit Card") gCREDIT_CARD_ID = Guid.Empty; float fEXCHANGE_RATE = new DynamicControl(ctlAllocationsView, rowCurrent, "EXCHANGE_RATE").FloatValue; var sbINVOICE_NUMBER = new StringBuilder(); if (dtPAYMENT_DATE == ((DateTime) SqlDateTime.MinValue) || e.CommandName == "Charge") dtPAYMENT_DATE = DateTime.Now; CommonProcedure.PatmentsUpdate (ref gID , gASSIGNED_USER_ID , gACCOUNT_ID , dtPAYMENT_DATE , sPAYMENT_TYPE , sCUSTOMER_REFERENCE , fEXCHANGE_RATE , gCURRENCY_ID , dAMOUNT , sDESCRIPTION , gTEAM_ID , gCREDIT_CARD_ID ); CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields); DataTable dtLineItems = ctlAllocationsView.LineItems; foreach (DataRow row in dtLineItems.Rows) { if (row.RowState == DataRowState.Deleted) { Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID", DataRowVersion.Original]); if (!CommonTypeConvert.IsEmptyGuid(gITEM_ID)) CommonProcedure.InvoicesPAYMENTS_Delete(gITEM_ID); } } foreach (DataRow row in dtLineItems.Rows) { if (row.RowState != DataRowState.Deleted) { Guid gITEM_ID = CommonTypeConvert.ToGuid(row["ID"]); Guid gINVOICE_ID = CommonTypeConvert.ToGuid(row["INVOICE_ID"]); Decimal dINVOICE_AMOUNT = CommonTypeConvert.ToDecimal(row["AMOUNT"]); if (!CommonTypeConvert.IsEmptyGuid(gINVOICE_ID)) { CommonProcedure.InvoicesPAYMENTS_Update (ref gITEM_ID , gINVOICE_ID , gID , dINVOICE_AMOUNT ); if (sbINVOICE_NUMBER.Length > 0) sbINVOICE_NUMBER.Append(","); sbINVOICE_NUMBER.Append(gINVOICE_ID.ToString()); } } } ViewState["ID"] = gID; if (e.CommandName == "Charge") { sbINVOICE_NUMBER.Append(" " + DateTime.UtcNow); //CRM.Common.Charge.CC.Charge(Application, gID, gCURRENCY_ID, gACCOUNT_ID, gCREDIT_CARD_ID, Request.UserHostAddress, sbINVOICE_NUMBER.ToString(), sDESCRIPTION, dAMOUNT); } Response.Redirect("view.aspx?ID=" + gID); } } else if (e.CommandName == "Cancel") { if (CommonTypeConvert.IsEmptyGuid(gID)) Response.Redirect("Index.aspx"); else Response.Redirect("view.aspx?ID=" + gID); } }
protected void Page_Command(Object sender, CommandEventArgs e) { if (e.CommandName == "Save") { ValidateEditViewFields(m_sMODULE + ".EditView"); if (Page.IsValid) { string sCUSTOM_MODULE = "PRODUCT_TEMPLATES"; DataTable dtCustomFields = CRMCache.FieldsMetaData_Validated(sCUSTOM_MODULE); var oQuery = new InlineQueryDBManager(); DataRow rowCurrent = null; var dtCurrent = new DataTable(); if (!CommonTypeConvert.IsEmptyGuid(gID)) { string innerSql = ApplicationSQL.SQL["Administration_ProductTemplates_EditView_39"].ToString(); oQuery.CommandText = innerSql; CRMSecurity.Filter(oQuery, m_sMODULE, "edit"); TypeConvert.AppendParameter(oQuery, gID, "ID", false); dtCurrent = oQuery.GetTable(); if (dtCurrent.Rows.Count > 0) { rowCurrent = dtCurrent.Rows[0]; } else { gID = Guid.Empty; } } CommonProcedure.ProductTemplatesUpdate (ref gID , new DynamicControl(this, rowCurrent, "NAME").Text , new DynamicControl(this, rowCurrent, "STATUS").SelectedValue , new DynamicControl(this, rowCurrent, "QUANTITY").IntegerValue , new DynamicControl(this, rowCurrent, "DATE_AVAILABLE").DateValue , new DynamicControl(this, rowCurrent, "DATE_COST_PRICE").DateValue , new DynamicControl(this, rowCurrent, "ACCOUNT_ID").ID , new DynamicControl(this, rowCurrent, "MANUFACTURER_ID").ID , new DynamicControl(this, rowCurrent, "CATEGORY_ID").ID , new DynamicControl(this, rowCurrent, "TYPE_ID").ID , new DynamicControl(this, rowCurrent, "WEBSITE").Text , new DynamicControl(this, rowCurrent, "MFT_PART_NUM").Text , new DynamicControl(this, rowCurrent, "VENDOR_PART_NUM").Text , new DynamicControl(this, rowCurrent, "TAX_CLASS").SelectedValue , new DynamicControl(this, rowCurrent, "WEIGHT").FloatValue , new DynamicControl(this, rowCurrent, "CURRENCY_ID").ID , new DynamicControl(this, rowCurrent, "COST_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "LIST_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "DISCOUNT_PRICE").DecimalValue , new DynamicControl(this, rowCurrent, "PRICING_FACTOR").IntegerValue , new DynamicControl(this, rowCurrent, "PRICING_FORMULA").SelectedValue , new DynamicControl(this, rowCurrent, "SUPPORT_NAME").Text , new DynamicControl(this, rowCurrent, "SUPPORT_CONTACT").Text , new DynamicControl(this, rowCurrent, "SUPPORT_DESCRIPTION").Text , new DynamicControl(this, rowCurrent, "SUPPORT_TERM").SelectedValue , new DynamicControl(this, rowCurrent, "DESCRIPTION").Text ); CRMDynamic.UpdateCustomFields(this, gID, sCUSTOM_MODULE, dtCustomFields); Response.Redirect("view.aspx?ID=" + gID); } } else if (e.CommandName == "Cancel") { if (CommonTypeConvert.IsEmptyGuid(gID)) Response.Redirect("Index.aspx"); else Response.Redirect("view.aspx?ID=" + gID); } }
public static DataTable MobileMenu() { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwMODULES_MobileMenu_ByUser." + Security.USER_ID] as DataTable; if (dt == null) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1252"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); Session["vwMODULES_MobileMenu_ByUser." + Security.USER_ID] = dt; } return dt; }
public static DataTable TabMenuDescription() { HttpSessionState Session = HttpContext.Current.Session; var dt = Session["vwMODULES_DESCRIPTION_ByUser." + Security.USER_ID] as DataTable; if (dt == null) { dt = new DataTable(); if (Security.IsAuthenticated()) { var oQuery = new InlineQueryDBManager(); string innerSql = ApplicationSQL.SQL["_code_CRMCache_1939"].ToString(); oQuery.CommandText = innerSql; oQuery.Add("@USER_ID", SqlDbType.UniqueIdentifier, Security.USER_ID); dt = oQuery.GetTable(); Session["vwMODULES_DESCRIPTION_ByUser." + Security.USER_ID] = dt; } } return dt; }