public List <tapalDistribution> getTapalListDateWiseSummary() { tapalDistribution taps; List <tapalDistribution> tpsList = new List <tapalDistribution>(); try { string query = "select Date,Forwarded,Pending " + " from ViewTapalSummary order by Date desc "; SqlConnection conn = new SqlConnection(Login.connString); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { taps = new tapalDistribution(); taps.Date = reader.GetDateTime(0); taps.RowID = reader.IsDBNull(1)? 0 : reader.GetInt32(1); taps.TapalReference = reader.IsDBNull(2) ? 0 : reader.GetInt32(2); tpsList.Add(taps); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(tpsList); }
// Tapal Summary public List <tapalDistribution> getTapalListSummaryForADate(DateTime dt) { tapalDistribution tapd; List <tapalDistribution> List = new List <tapalDistribution>(); try { string query = "select a.RowID,a.Date,b.Date, a.FileName, a.InwardDocumentType,a.ReceivedFrom,a.Status ,a.CreateUser,f.Name," + "b.CreateUser,h.Name,b.UserID ,d.Name,b.CreateTime,b.Status,b.RowID,a.Description" + " from TapalStorage AS a LEFT OUTER JOIN " + " TapalDistribution AS b ON a.RowID = b.TapalReference LEFT OUTER JOIN " + " ERPUser AS c on b.UserID = c.UserID LEFT OUTER JOIN " + " Employee AS d on c.EmployeeID = d.EmployeeID LEFT OUTER JOIN " + " ERPUser AS e on a.CreateUser = e.UserID LEFT OUTER JOIN " + " Employee AS f on e.EmployeeID = f.EmployeeID LEFT OUTER JOIN" + " ERPUser AS g on b.CreateUser = g.UserID LEFT OUTER JOIN " + "Employee AS h on g.EmployeeID = h.EmployeeID" + " where a.Date = '" + dt.ToString("yyyy-MM-dd") + "' order by a.RowID"; SqlConnection conn = new SqlConnection(Login.connString); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { tapd = new tapalDistribution(); tapd.RowID = reader.GetInt32(0); tapd.Date = reader.GetDateTime(1); tapd.DistibuteDate = reader.IsDBNull(2)?DateTime.Parse("01-01-1900") : reader.GetDateTime(2); tapd.FileName = reader.GetString(3); tapd.InwardDocumentType = reader.GetString(4); tapd.ReceivedFrom = reader.IsDBNull(5) ? "" : reader.GetString(5); tapd.Status = reader.GetInt32(6); tapd.CreateUser = reader.IsDBNull(7) ? "" : reader.GetString(7); tapd.Creator = reader.IsDBNull(8) ? "" : reader.GetString(8); tapd.DistributeUser = reader.IsDBNull(9) ? "" : reader.GetString(9); tapd.Distributor = reader.IsDBNull(10) ? "" : reader.GetString(10); tapd.UserID = reader.IsDBNull(11) ? "" : reader.GetString(11); tapd.UserName = reader.IsDBNull(12) ? "" : reader.GetString(12); tapd.CreateTime = reader.IsDBNull(13) ? DateTime.Parse("01-01-1900") : reader.GetDateTime(13); tapd.ActionStatus = reader.IsDBNull(14) ? -1 : reader.GetInt32(14); tapd.ActionReferenceID = reader.IsDBNull(15) ? -1 : reader.GetInt32(15); tapd.Description = reader.IsDBNull(16) ? "" : reader.GetString(16); List.Add(tapd); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(List); }
public List <tapalDistribution> getTapalListInDashBoard(string logInUserID) { tapalDistribution tapd; List <tapalDistribution> List = new List <tapalDistribution>(); try { string query = "select a.RowID,a.DocumentID,a.Date,d.FileName,a.UserID,d.ReceivedFrom,d.InwardDocumentType,a.CreateUser,c.name ,a.TapalReference,d.Description " + " from TapalDistribution a , ERPUser b, Employee c, TapalStorage d " + " where a.CreateUser = b.UserID and b.EmployeeID = c.EmployeeID and a.TapalReference = d.RowID " + "and a.UserID = '" + logInUserID + "' and (a.Status = 0 or a.Status=3) order by a.Date desc"; SqlConnection conn = new SqlConnection(Login.connString); SqlCommand cmd = new SqlCommand(query, conn); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { tapd = new tapalDistribution(); tapd.RowID = reader.GetInt32(0); tapd.DocumentID = reader.GetString(1); tapd.Date = reader.GetDateTime(2); tapd.FileName = reader.GetString(3); tapd.UserID = reader.GetString(4); tapd.ReceivedFrom = reader.GetString(5); tapd.InwardDocumentType = reader.GetString(6); tapd.CreateUser = reader.GetString(7); tapd.Creator = reader.GetString(8); tapd.TapalReference = reader.GetInt32(9); tapd.Description = reader.IsDBNull(10)?"":reader.GetString(10); List.Add(tapd); } conn.Close(); } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(List); }
public Boolean MoveTapal(string userID, tapalDistribution tap) { Boolean status = true; string utString = ""; try { string updateSQL = "update TapalDistribution set Status = 1" + " where RowID=" + tap.RowID; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "TapalDistribution", "", updateSQL) + Main.QueryDelimiter; updateSQL = updateSQL = "insert into TapalDistribution " + "(DocumentID, TapalReference, UserID, Date, Status,CreateTime,CreateUser) " + "values ('" + tap.DocumentID + "'," + tap.TapalReference + ",'" + userID + "','" + tap.Date.ToString("yyyy-MM-dd") + "'," + tap.Status + "," + "GETDATE()" + ",'" + Login.userLoggedIn + "')"; utString = utString + updateSQL + Main.QueryDelimiter; utString = utString + ActivityLogDB.PrepareActivityLogQquerString("update", "TapalDistribution", "", updateSQL) + Main.QueryDelimiter; if (!UpdateTable.UT(utString)) { status = false; } } catch (Exception) { status = false; MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } return(status); }