Exemple #1
0
 public override TaskPrintInfo GetTaskPrintInfo(int taskId)
 {
     database = DatabaseFactory.CreateDatabase();
     StringBuilder builder = new StringBuilder();
     builder.Append("SELECT PTO.*,(SELECT COUNT(*) FROM Hishop_PrintTaskOrders PTO INNER JOIN Hishop_Orders O ON O.OrderId=PTO.OrderId WHERE PTO.taskId=@TaskId AND O.IsPrinted=1) as OrderCount ,(SELECT COUNT(*) FROM Hishop_PrintTaskOrders PTO INNER JOIN Hishop_PurchaseOrders O ON PTO.OrderId=O.PurchaseOrderId WHERE PTO.taskId=@TaskId AND O.IsPrinted=1) as PurchaseCount FROM Hishop_PrintTask PTO WHERE PTO.TaskId=@TaskId;");
     builder.Append("SELECT PTO.OrderId,O.address,O.ModeName,O.ShippingRegion,O.ShipTo,ISNULL(O.IsPrinted,0) IsPrinted,O.Remark,O.ManagerRemark FROM Hishop_PrintTaskOrders PTO INNER JOIN Hishop_Orders O ON O.OrderId=PTO.OrderId WHERE taskId=@TaskId UNION SELECT PTO.OrderId,O.address,O.ModeName,O.ShippingRegion,O.ShipTo,ISNULL(O.IsPrinted,0) IsPrinted,O.Remark,O.ManagerRemark FROM Hishop_PrintTaskOrders PTO INNER JOIN Hishop_PurchaseOrders O ON PTO.OrderId=O.PurchaseOrderId WHERE taskId=@TaskId");
     DbCommand sqlStringCommand = database.GetSqlStringCommand(builder.ToString());
     database.AddInParameter(sqlStringCommand, "TaskId", DbType.Int32, taskId);
     TaskPrintInfo info = new TaskPrintInfo();
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read())
         {
             info.TaskId = (int)reader["TaskId"];
             if (reader["Creator"] != DBNull.Value)
             {
                 info.Creator = (string)reader["Creator"];
             }
             if (reader["CreateDate"] != DBNull.Value)
             {
                 info.CreateTime = (DateTime)reader["CreateDate"];
             }
             info.HasPrinted = ((int)reader["OrderCount"]) + ((int)reader["PurchaseCount"]);
             if (reader["IsPO"] != DBNull.Value)
             {
                 info.IsPO = (bool)reader["IsPO"];
             }
         }
         if (reader.NextResult())
         {
             DataTable table = DataHelper.ConverDataReaderToDataTable(reader);
             info.Orders = table;
         }
     }
     return info;
 }
Exemple #2
0
 private void BindPrintOrders(TaskPrintInfo task)
 {
     if ((task != null) && (task.TaskId > 0))
     {
         litCreateTime.Text = task.CreateTime.ToString();
         litCreator.Text = task.Creator;
         litTaskId.Text = task.TaskId.ToString();
         litPrintedNum.Text = task.HasPrinted.ToString();
         litNumber.Text = task.OrdersCount.ToString();
         pnlTask.Visible = true;
         pnlTaskEmpty.Visible = false;
         isPO = task.IsPO;
         if (isPO)
         {
             pnlPOEmpty.Visible = true;
         }
         else
         {
             pnlPOEmpty.Visible = false;
         }
     }
     else
     {
         pnlTask.Visible = false;
         pnlTaskEmpty.Visible = true;
         pnlPOEmpty.Visible = false;
     }
 }