Esempio n. 1
0
        public static void Show(Form mdiParent, PurOrderId orderId)
        {
            PurLineForm existingForm = FindOrder(orderId);

            if (existingForm != null)
            {
                existingForm.Activate();
                if (existingForm.WindowState == FormWindowState.Minimized)
                {
                    existingForm.WindowState = FormWindowState.Normal;
                }
                return;
            }
            PurLineForm newForm = new PurLineForm();
            PurOrder    order;

            using (Ambient.DbSession.Activate())
            {
                order            = OrderingRepositories.PurOrder.Get(orderId);
                newForm.VendorId = order.VendorId;
                Vendor vendor = OrderingRepositories.Vendor.Get(order.VendorId);
                newForm.Text = "Order: " + vendor.VendorName + " " + order.OrderDate.ToString("MM/dd/yyyy");
            }
            newForm.OrderId   = orderId;
            newForm.Order     = order;
            newForm.MdiParent = mdiParent;
            mInstances.Add(newForm);
            newForm.Show();
        }
Esempio n. 2
0
 public void SaveToDefinitions(PurOrderId orderId)
 {
     ExecuteNonQuery("dbo.PurLineSaveToDefinitions",
                     delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     });
 }
Esempio n. 3
0
 public List <ProductCategory> GetCategories(PurOrderId orderId)
 {
     return(mCategoryRep.Search("dbo.PurLineGetCategories",
                                delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     }));
 }
Esempio n. 4
0
 public List <PurLine> GetInShelfOrder(PurOrderId orderId)
 {
     return(Search("dbo.GetPurLineByShelfOrder",
                   delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
     }));
 }
Esempio n. 5
0
 public void AddCategory(PurOrderId orderId, ProductCategoryId categoryId, bool includeInactive)
 {
     ExecuteNonQuery("dbo.PurLineAddCategory",
                     delegate(SqlCommand cmd)
     {
         SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
         SqlHelper.AddParamInputId(cmd, "@CategoryId", categoryId.Value);
         SqlHelper.AddParamInt(cmd, "@IncludeInactive", includeInactive ? 1 : 0);
     });
 }
Esempio n. 6
0
 public static PurLineForm FindOrder(PurOrderId orderId)
 {
     foreach (PurLineForm form in mInstances)
     {
         if (form.OrderId == orderId)
         {
             return(form);
         }
     }
     return(null);
 }
Esempio n. 7
0
        public int RemoveCategory(PurOrderId orderId, ProductCategoryId categoryId)
        {
            SqlParameter outputParam = null;

            ExecuteNonQuery("dbo.PurLineRemoveCategory",
                            delegate(SqlCommand cmd)
            {
                SqlHelper.AddParamInputId(cmd, "@OrderId", orderId.Value);
                SqlHelper.AddParamInputId(cmd, "@CategoryId", categoryId.Value);
                outputParam = SqlHelper.AddParamOutputInt(cmd, "@LinesRemaining");
            });
            return((int)outputParam.Value);
        }
Esempio n. 8
0
 public void Run(PurOrderId orderId, IOrderReportWriter writer, IOrderReportFilter filter,
                 bool shelfOrder, string title, Form mdiParent)
 {
     mTitle      = title;
     mOrderId    = orderId;
     mWriter     = writer;
     mFilter     = filter;
     mShelfOrder = shelfOrder;
     using (Ambient.DbSession.Activate())
     {
         PurOrder order = OrderingRepositories.PurOrder.Get(orderId);
         mVendor   = OrderingRepositories.Vendor.Get(order.VendorId);
         this.Text = title + " for " + mVendor.VendorName + " " + order.OrderDate.ToString("MM/dd/yyyy");
     }
     Run(mdiParent);
     //this.MdiParent = mdiParent;
     //this.Show();
 }
Esempio n. 9
0
 public void Show(VendorId vendorId, PurOrderId purOrderId,
                  PersistedBindingList <JoinPlToVpToProd> purLines,
                  List <ProductSubCategory> subCats,
                  List <ProductBrand> brands)
 {
     mVendorId          = vendorId;
     mOrderId           = purOrderId;
     mPurLines          = purLines;
     mPurLineDictionary = new Dictionary <string, JoinPlToVpToProd>();
     foreach (JoinPlToVpToProd purLine in mPurLines)
     {
         if (!string.IsNullOrEmpty(purLine.PurLine_VendorPartNum))
         {
             mPurLineDictionary.Add(purLine.PurLine_VendorPartNum, purLine);
         }
     }
     mSubCats = subCats;
     mBrands  = brands;
     this.ShowDialog();
 }
Esempio n. 10
0
        private void ShowOrderCategories(PurOrderId orderId)
        {
            List <ProductCategory> categories;

            using (Ambient.DbSession.Activate())
            {
                categories = OrderingRepositories.PurLine.GetCategories(orderId);
            }
            lstCategories.ClearSelected();
            foreach (ProductCategory selectedCat in categories)
            {
                for (int index = 0; index < lstCategories.Items.Count; index++)
                {
                    ProductCategory currentCat = (ProductCategory)lstCategories.Items[index];
                    if (currentCat.Id == selectedCat.Id)
                    {
                        lstCategories.SetSelected(index, true);
                        break;
                    }
                }
            }
        }