public static InvtTxSearcher ShowTxSearcher(string targetSQLViewName, EnumHelper.TxType txType) { RT2020.Controls.InvtTxSearcher searchForm = new RT2020.Controls.InvtTxSearcher(); searchForm.SqlQuery = string.Format("SELECT HeaderId, TxNumber, TxType, TxDate FROM {0}", targetSQLViewName); searchForm.TxType = txType; return(searchForm); }
/// <summary> /// Initializes a new instance of the <see cref="Worksheet"/> class. /// </summary> /// <param name="salesType">Type of the sales.</param> public Worksheet(EnumHelper.TxType salesType) { InitializeComponent(); this.SalesType = salesType; dtpFromDate.Value = Convert.ToDateTime(SystemInfoEx.CurrentInfo.Default.CurrentSystemDate.ToString("yyyy-MM-01")); dtpToDate.Value = Convert.ToDateTime(SystemInfoEx.CurrentInfo.Default.CurrentSystemDate.ToString("yyyy-MM-" + DateTime.Now.ToString("dd"))); FillComboList(); }
/// <summary> /// Initializes a new instance of the <see cref="History"/> class. /// </summary> /// <param name="salesType">Type of the sales.</param> public History(EnumHelper.TxType salesType) { InitializeComponent(); this.SalesType = salesType; dtpFromDate.Value = Convert.ToDateTime(SystemInfoEx.CurrentInfo.Default.LastMonthEnd.Insert(4, "-") + "-01"); dtpToDate.Value = Convert.ToDateTime(SystemInfoEx.CurrentInfo.Default.CurrentSystemDate.ToString("yyyy-MM-" + DateTime.Now.ToString("dd"))); FillComboList(); }
public DefaultList(Control toolBar, EnumHelper.TxType txType) { InitializeComponent(); SalesToolbar tb = new SalesToolbar(toolBar, ref tbControl); this.SalesType = txType; base.ExportClick += new MenuEventHandler(DefaultList_ExportClick); base.RefreshClick += new EventHandler(DefaultList_RefreshClick); base.PreferenceClick += new EventHandler(DefaultList_PreferenceClick); base.BindingListDoubleClick += new EventHandler(DefaultList_BindingListDoubleClick); base.ComboBoxSelectedIndexChanged += new EventHandler(DefaultList_ComboBoxSelectedIndexChanged); base.ButtonClick += new EventHandler(DefaultList_ButtonClick); base.ShowClick += new EventHandler(DefaultList_ShowClick); }
/// <summary> /// Queuings the tx number. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="typeName">Name of the type. Enums: EnumHelper.TxType, EnumHelper.POType</param> /// <returns>TxNumber</returns> public static string QueuingTxNumber <T>(T typeName) { string query = " 1 = 1 "; string queuingType = string.Empty; switch (typeName.GetType().Name) { case "TxType": EnumHelper.TxType txType = (EnumHelper.TxType)Convert.ChangeType(typeName, typeof(EnumHelper.TxType)); query = "QueuingType = '" + txType.ToString() + "'"; queuingType = txType.ToString(); break; case "POType": EnumHelper.POType poType = (EnumHelper.POType)Convert.ChangeType(typeName, typeof(EnumHelper.POType)); query = "QueuingType = '" + poType.ToString() + "'"; queuingType = poType.ToString(); break; } long queuedTxNumber = 1; using (var ctx = new EF6.RT2020Entities()) { var oQueue = ctx.SystemQueue.SqlQuery( String.Format( "Select * from SystemQueue Where {0}", String.IsNullOrEmpty(query) ? "1 = 1" : query )) .FirstOrDefault(); if (oQueue == null) { oQueue = new EF6.SystemQueue(); oQueue.QueueId = Guid.NewGuid(); oQueue.QueuingType = queuingType; oQueue.LastNumber = "000000000000"; ctx.SystemQueue.Add(oQueue); } queuedTxNumber = Convert.ToInt64(oQueue.LastNumber) + 1; oQueue.LastNumber = queuedTxNumber.ToString(); ctx.SaveChanges(); } return(queuedTxNumber.ToString().PadLeft(12, '0')); }
/// <summary> /// Queuings the tx number. /// </summary> /// <param name="txType">Type of the transactions.</param> /// <returns></returns> public static string QueuingTxNumber(EnumHelper.TxType txType) { return(QueuingTxNumber <EnumHelper.TxType>(txType)); }
public static void ShowCriteria(ref TextBox txtTxNumberFrom, ref TextBox txtTxNumberTo, string targetSQLViewName, EnumHelper.TxType txType, DateTime from, DateTime to) { string sql = @" SELECT MIN(TxNumber) AS TxNumber FROM " + targetSQLViewName + " WHERE TxType = '" + txType.ToString() + "' AND TxDate >= '" + from.ToString("yyyy-MM-dd") + "'"; SqlCommand cmd = new SqlCommand(); cmd.CommandText = sql; cmd.CommandTimeout = ConfigHelper.CommandTimeout; cmd.CommandType = CommandType.Text; using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd)) { while (reader.Read()) { if (!(reader[0] is DBNull)) { txtTxNumberFrom.Text = reader.GetString(0); } } } sql = @" SELECT MAX(TxNumber) AS TxNumber FROM " + targetSQLViewName + " WHERE TxType = '" + txType.ToString() + "' AND TxDate <= '" + to.ToString("yyyy-MM-dd") + "'"; cmd = new SqlCommand(); cmd.CommandText = sql; cmd.CommandTimeout = ConfigHelper.CommandTimeout; cmd.CommandType = CommandType.Text; using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(cmd)) { while (reader.Read()) { if (!(reader[0] is DBNull)) { txtTxNumberTo.Text = reader.GetString(0); } } } }