Example #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id.Length != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (Length != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Length);
            }
            if (Width != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Width);
            }
            if (Height != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Height);
            }
            if (Qty != 0)
            {
                hash ^= Qty.GetHashCode();
            }
            if (Weight != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Weight);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Example #2
0
        public async Task <JsonResult> BulkUpdate(Qty model)
        {
            string userId = User.Identity.GetUserId();
            await _cart.BulkQuantityUpdateItemForCart(Guid.Parse(model.id), userId, int.Parse(model.qty));

            return(Json("Proccess completed successfuly", JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Returns true if OrderItem instances are equal
        /// </summary>
        /// <param name="other">Instance of OrderItem to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OrderItem other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     ItemName == other.ItemName ||
                     ItemName != null &&
                     ItemName.Equals(other.ItemName)
                     ) &&
                 (
                     Qty == other.Qty ||
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     UnitPrice.Equals(other.UnitPrice)
                 ) &&
                 (
                     Cost.Equals(other.Cost)
                 ));
        }
 public ActionResult Catalogue([Bind(Include = "testID,qty")] Qty qty)
 {
     if (ModelState.IsValid)
     {
         return(RedirectToAction("Index"));
     }
     return(View());
 }
        public void combineGroup(Group g)
        /*將單一group合併到本group*/
        {
            //確認g是單一Group
            if (g.Qty.Count > 1)
            {
                //Globals.ThisAddIn.odiMsgOut("[Error] Can't comine complex group, check code!");
                MessageBox.Show("[Error] Can't comine complex group, check code!");
                return;
            }
            else
            {
                //合併main source資料
                Qty.Add(g.Qty[0]);
                ProjectName.Add(g.ProjectName[0]);
                SCHVersion.Add(g.SCHVersion[0]);
                BOMVersion.Add(g.BOMVersion[0]);
                BOMKey.Add(g.getBomKey());

                //歷遍目前AVL,找到相同的合併,並且從g移除
                bool foundAVLing;
                foreach (var i in AVL)
                {
                    foundAVLing = g.AVL.TryGetValue(i.Key, out Item gi);

                    i.Value.ProjectName.Add(g.ProjectName[0]); //不論有沒有找到,都要增加project欄位
                    i.Value.SCHVersion.Add(g.SCHVersion[0]);
                    i.Value.BOMVersion.Add(g.BOMVersion[0]);
                    i.Value.BOMKey.Add(g.getBomKey());
                    if (foundAVLing)
                    {
                        i.Value.Qty.Add(gi.Qty[0]);
                        g.AVL.Remove(i.Key);
                    }
                    else
                    {
                        i.Value.Qty.Add(0);
                    }
                }

                //如果g還有剩下(新的)AVL item,則加入目前的AVL dictionary, 並且補足其前面的空白欄位
                if (g.AVL.Count > 0)
                {
                    foreach (var j in g.AVL)
                    {
                        j.Value.ProjectName = ProjectName;
                        j.Value.SCHVersion  = SCHVersion;
                        j.Value.BOMVersion  = BOMVersion;
                        j.Value.BOMKey      = BOMKey;
                        for (int k = 0; k < Qty.Count() - 1; k++)
                        {
                            j.Value.Qty.Insert(0, 0);
                        }
                        AVL.Add(j.Key, j.Value);
                    }
                }
            }
        }
Example #6
0
 /*
  * CONVERTS TO STRING (to later be displayed on a listbox)*/
 public override string ToString()
 {
     if (Name.Length < 8)
     {
         return(ID.ToString() + "\t\t" + Name + "\t\t\t" + Qty.ToString() + '\t' + QtyReq.ToString());
     }
     else
     {
         return(ID.ToString() + "\t\t" + Name + "\t\t" + Qty.ToString() + '\t' + QtyReq.ToString());
     }
 }
Example #7
0
        public virtual int _GetUniqueIdentifier()
        {
            var hashCode = 399326290;

            hashCode = hashCode * -1521134295 + (TransportDetailsID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (EventID?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (Qty?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ExtDateStart?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ExtTimeStart?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (ExtTimeAction?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RealDateStart?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RealTimeStart?.GetHashCode() ?? 0);
            hashCode = hashCode * -1521134295 + (RealTimeAction?.GetHashCode() ?? 0);
            return(hashCode);
        }
Example #8
0
 private async void InsertIntoCart(int?obj)
 {
     try
     {
         if (obj != null)
         {
             var item = ListPro.SingleOrDefault(t => t.ProductID == (int)obj);
             if (item != null)
             {
                 if (!string.IsNullOrEmpty(Qty) && Qty.IsNum())
                 {
                     if (ListOD.SingleOrDefault(t => t.ProductID == (int)obj) == null)
                     {
                         if (Convert.ToInt32(Qty) <= RestQty && RestQty >= 0)
                         {
                             var ProOD = new ProductODModel()
                             {
                                 ProductID = _selectedPro.ProductID,
                                 Name      = _selectedPro.Name,
                             };
                             ProOD.OrderQty  = Convert.ToInt32(Qty);
                             ProOD.UnitPrice = (double)_selectedPro.UnitOnOrder;
                             ProOD.StoreID   = SelectedSto.StoreID;
                             Subtotal       += (double)_selectedPro.UnitOnOrder * Convert.ToInt32(Qty);
                             ListOD.Add(ProOD);
                         }
                         else
                         {
                             MessageBox.Show("số lượng phải nhỏ hơn hoặc bằng số lượng hiện tại", "Thông Báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                         }
                     }
                     else
                     {
                         MessageBox.Show("Đã Tồn Tại Trong Giỏ Hàng", "Thông Báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Có Lỗi - Số Lượng Phải Là Số", "Thông Báo", MessageBoxButton.OK, MessageBoxImage.Warning);
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("Có Lỗi", "Thông Báo", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Example #9
0
        private void Form2_Load(object sender, EventArgs e)
        {
            PName.Text = "Select-an-option";
            Qty.Clear();
            Rate.Clear();
            SqlDataAdapter da = new SqlDataAdapter("select Product_Name from Add_Product ", con);
            DataSet        ds = new DataSet();

            da.Fill(ds, "login");
            int index = 0;

            for (index = 0; index < ds.Tables[0].Rows.Count; index++)
            {
                PName.Items.Add(ds.Tables[0].Rows[index][0]);
            }
        }
Example #10
0
 private string GetSeperatedParameters()
 {
     return(OrgNo + ";"
            + FeeNo + ";"
            + RegNo + ";"
            + PriceCode + ";"
            + PriceName + ";"
            + StartDate + ";"
            + StartTime + ";"
            + EndDate + ";"
            + EndTime + ";"
            + Qty.ToString() + ";"
            + TakeTime + ";"
            + Id + ";"
            + Operation + ";"
            + FilePath + ";"
            + FileName);
 }
Example #11
0
        public static List <Qty> GetQtys(int GSETypeId)
        {
            List <Qty> lstQty = new List <Qty>();

            //Accessing DB Layer
            DbCommand dbCommand = db.GetStoredProcCommand("prSelQtysByGSETypeId");

            db.AddInParameter(dbCommand, "GSETypeID", DbType.String, GSETypeId);

            IDataReader dr = null;

            try
            {
                // Execute command
                dr = db.ExecuteReader(dbCommand);

                //Set Output  and add to the list
                while (dr.Read())
                {
                    Qty objQty = new Qty();
                    objQty.QtyId                 = dr["QuantityId"].ToString();
                    objQty.Description           = dr["Description"].ToString();
                    objQty.GSETypeId             = Convert.ToInt32(dr["GSETypeId"]);
                    objQty.MetricUnitDescription = dr["MetricUnitDescription"].ToString();

                    if (!String.IsNullOrEmpty(dr["ImperialUnitDescription"].ToString()))
                    {
                        objQty.ImperialUnitDescription = dr["ImperialUnitDescription"].ToString();
                        objQty.MetricConversionRatio   = Convert.ToSingle(dr["MetricConversionRatio"]);
                    }

                    lstQty.Add(objQty);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.ToString());
            }
            finally
            {
                dr.Close();
            }
            return(lstQty);
        }
Example #12
0
        /// <summary>
        /// Returns true if Position instances are equal
        /// </summary>
        /// <param name="other">Instance of Position to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Position other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Instrument == other.Instrument ||
                     Instrument != null &&
                     Instrument.Equals(other.Instrument)
                 ) &&
                 (
                     Qty == other.Qty ||
                     Qty != null &&
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     Side == other.Side ||
                     Side != null &&
                     Side.Equals(other.Side)
                 ) &&
                 (
                     AvgPrice == other.AvgPrice ||
                     AvgPrice != null &&
                     AvgPrice.Equals(other.AvgPrice)
                 ) &&
                 (
                     UnrealizedPl == other.UnrealizedPl ||
                     UnrealizedPl != null &&
                     UnrealizedPl.Equals(other.UnrealizedPl)
                 ));
        }
Example #13
0
        /// <summary>
        /// Returns true if Execution instances are equal
        /// </summary>
        /// <param name="other">Instance of Execution to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Execution other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Instrument == other.Instrument ||
                     Instrument != null &&
                     Instrument.Equals(other.Instrument)
                 ) &&
                 (
                     Price == other.Price ||
                     Price != null &&
                     Price.Equals(other.Price)
                 ) &&
                 (
                     Time == other.Time ||
                     Time != null &&
                     Time.Equals(other.Time)
                 ) &&
                 (
                     Qty == other.Qty ||
                     Qty != null &&
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     Side == other.Side ||
                     Side != null &&
                     Side.Equals(other.Side)
                 ));
        }
        protected void ProductName_TextChanged(object sender, EventArgs e)
        {
            SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["conn"].ToString());
            SqlCommand    cmd = new SqlCommand("", con);

            cmd.CommandText = "select *,dbo.GETAVLQTY(productId,@FrenchiseID)as AQTY from ProductRepurchase where ProductName = @ProductName and Status != 1 ";

            cmd.Parameters.AddWithValue("@productName", ProductName.Text);
            cmd.Parameters.AddWithValue("@FrenchiseID", ConfigurationManager.AppSettings["FrenchiseID"].ToString());
            con.Open();
            cmd.CommandTimeout = 0;
            SqlDataReader dr = cmd.ExecuteReader();

            while (dr.Read())
            {
                PID.Value           = dr["ProductID"].ToString();
                ProductCode.Text    = dr["ProductCode"].ToString();
                MRP.Text            = dr["MRP"].ToString().Replace(".0000", ".00");
                SpecialDiscount     = Convert.ToDecimal(dr["DiscountAmount"].ToString().Replace(".0000", ".00"));
                SPDiscount.Text     = SpecialDiscount.ToString();
                DP.Text             = dr["SalesAmount"].ToString().Replace(".0000", ".00");
                BV.Text             = dr["BV"].ToString();
                Tax.Text            = dr["vat"].ToString();
                CashBack.Text       = dr["CashBack"].ToString();
                txtselcashback.Text = dr["SelfCashBack"].ToString();
                CGST.Text           = string.Format("{0:f2}", decimal.Parse(dr["CGST"].ToString()));
                SGST.Text           = string.Format("{0:f2}", decimal.Parse(dr["SGST"].ToString()));
                IGST.Text           = string.Format("{0:f2}", decimal.Parse(dr["IGST"].ToString()));
                Cess.Text           = string.Format("{0:f2}", decimal.Parse(dr["Cess"].ToString()));
                Qty.Text            = "1";
                // Amount.Text = string.Format("{0:f2}", (decimal.Parse(Qty.Text) * decimal.Parse(DP.Text)));
                //Amount.Text = string.Format("{0:f2}", (decimal.Parse(DP.Text) - decimal.Parse(SPDiscount.Text)));
                Amount.Text = string.Format("{0:f2}", (decimal.Parse(DP.Text) * (decimal.Parse(Qty.Text)) - decimal.Parse(SPDiscount.Text)));

                //   txtAVLQTY.Text = dr["AQTY"].ToString();
                //imageload.HRef = dr["ImageUrl"].ToString();
            }

            dr.Close();
            con.Close();
            Qty.Focus();
        }
Example #15
0
        public string PrintTotal()
        {
            StringBuilder line = new StringBuilder();

            if (IsImport)
            {
                line.Append("Imported ");
            }

            line.Append(Description + ": ");

            if (Qty > 1)
            {
                line.Append($"{TotalCost()} ({Qty.ToString()} @ {TotalPrice()})");
            }
            else
            {
                line.Append(TotalCost());
            }

            return(line.ToString());
        }
Example #16
0
        public override string ToString()
        {
            string str = "";

            str += "&idserver=\"" + IDServer.ToString() + "\"";

            if (IDUser != -1)
            {
                str += "&iduser=\"" + IDUser.ToString() + "\"";
            }
            if (IDCategory != 0)
            {
                str += "&idcategory=\"" + IDCategory.ToString() + "\"";
            }
            if (IDMealUnit != 0)
            {
                str += "&idmealunit=\"" + IDServerMealUnit.ToString() + "\"";
            }
            if (Qty != 0)
            {
                str += "&qty=\"" + Qty.ToString() + "\"";
            }
            if (MealDate != null)
            {
                str += "&mealdate=\"" + MealDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }
            if (InsertDate != null)
            {
                str += "&insertdate=\"" + InsertDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }
            if (UpdateDate != null)
            {
                str += "&updatedate=\"" + UpdateDate.ToString("yyyy-MM-dd HH:mm:ss") + "\"";
            }

            return(str.Substring(1));
        }
Example #17
0
        private async void discounttxt_LostFocus(object sender, RoutedEventArgs e)
        {
            MainWindow mainWindow = (MainWindow)Application.Current.MainWindow;

            if (!string.IsNullOrEmpty(Price.Text) && !string.IsNullOrEmpty(Qty.Text))
            {
                calculateTotal();
            }
            else
            {
                if (string.IsNullOrEmpty(Qty.Text))
                {
                    await mainWindow.ShowMessageAsync("Please Enter Qunatity", "");

                    Qty.Focus();
                }
                else if (string.IsNullOrEmpty(Price.Text))
                {
                    await mainWindow.ShowMessageAsync("Please Enter Unitprice", "");

                    Price.Focus();
                }
            }
        }
Example #18
0
        /// <summary>
        ///     加载页面数据
        /// </summary>
        private void LoadData()
        {
            txtKeyId.Text      = KeyId;
            txtFMarginEnd.Text = Qty.ToString(CultureInfo.InvariantCulture);
            txtFQty.Text       = Qty.ToString(CultureInfo.InvariantCulture);

            switch (Actions)
            {
            case WebAction.Add:
                break;

            case WebAction.Edit:

                if (To != null)
                {
                    txtFMarginEnd.Text    = To.XMarginEnd.ToString();
                    ddlBill.SelectedValue = To.XBill;
                    tbxFVehicleNum.Text   = To.XVehicleNum;
                    txtFQty.Text          = To.XQty.ToString();
                    txtFMemo.Text         = To.XMemo;
                }
                break;
            }
        }
Example #19
0
 public override int GetHashCode()
 {
     return(Qty.GetHashCode() ^ SellItem.GetHashCode());
 }
Example #20
0
    private void Newstock()
    {
        divBack.Visible = true;
        decimal   Qty;
        DataTable dtCollect = new DataTable();

        dtCollect.Columns.Add("CreatedDate", typeof(DateTime));
        dtCollect.Columns.Add("Qty", typeof(decimal));
        dtCollect.Columns.Add("Productname");
        dtCollect.Columns.Add("BQty", typeof(decimal));
        dtCollect.Columns.Add("Balance", typeof(decimal));
        decimal BQty = 0;

        string[]  code = ddlSeasonYear.Text.Split(new string[] { "20" }, StringSplitOptions.None);
        DataTable dtUniqeCollectionDates = reportObj.GetCollectionDates(Convert.ToInt32(ddlProduct.SelectedValue), code[1].ToString());
        DataTable dt = reportObj.GetNewallcollectionList(ddlProduct.SelectedValue, code[1].ToString());

        foreach (DataRow Date in dtUniqeCollectionDates.Rows)
        {
            foreach (DataRow item in dt.Rows)
            {
                if (Date["CreatedDate"].ToString() == item["CreatedDate"].ToString())
                {
                    DataRow drNew = dtCollect.NewRow();
                    if (item["CollectionQty"].ToString().Contains("@"))
                    {
                        string[] CollectionQty = item["CollectionQty"].ToString().Split('@');
                    }
                    else
                    {
                        string[] CollectionQty1 = item["CollectionQty"].ToString().Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                        Qty = 0;
                        for (int i = 0; i < CollectionQty1.Length; i++)
                        {
                            Qty = Qty + Convert.ToDecimal(CollectionQty1[i].ToString());
                        }
                        drNew["Qty"] = Qty.ToString();
                    }
                    drNew["ProductName"] = item["ProductName"].ToString();
                    drNew["CreatedDate"] = Convert.ToDateTime(item["CreatedDate"]);
                    drNew["BQty"]        = "0.00";
                    drNew["Balance"]     = "0.00";
                    dtCollect.Rows.Add(drNew);
                }
            }
        }
        DataTable dtblend1 = reportObj.GetSelectedBlendQty(code[1].ToString(), Convert.ToInt32(ddlProduct.SelectedValue));

        for (int i = 0; i < dtblend1.Rows.Count; i++)
        {
            DataTable dtDate1 = reportObj.GetSelectedCollectionDate(dtblend1.Rows[i]["createddate"].ToString(), Convert.ToInt32(ddlProduct.SelectedValue));
            if (dtblend1.Rows.Count > 0)
            {
                DataRow drNew1   = dtCollect.NewRow();
                decimal BlendQty = 0;
                if (dtDate1.Rows.Count > 0)
                {
                    if (dtDate1.Rows[0]["createddate"].ToString() == dtblend1.Rows[i]["createddate"].ToString())
                    {
                        BlendQty              = BlendQty + Convert.ToDecimal(dtblend1.Rows[i]["BQty"].ToString());
                        drNew1["Qty"]         = "0.00";
                        drNew1["Productname"] = dtblend1.Rows[i]["ProductName"].ToString();
                        drNew1["CreatedDate"] = dtblend1.Rows[i]["createddate"].ToString();
                        drNew1["BQty"]        = BlendQty.ToString();
                        dtCollect.Rows.Add(drNew1);
                    }
                }
                else
                {
                    drNew1["Qty"]         = "0.00";
                    drNew1["Productname"] = dtblend1.Rows[i]["ProductName"].ToString();
                    drNew1["CreatedDate"] = dtblend1.Rows[i]["createddate"].ToString();
                    drNew1["BQty"]        = dtblend1.Rows[i]["BQty"].ToString();
                    dtCollect.Rows.Add(drNew1);
                }
            }
        }
        DataView dv = dtCollect.DefaultView;

        dv.Sort = "CreatedDate asc";
        DataTable sortedDT = dv.ToTable();

        if (sortedDT.Rows.Count > 0)
        {
            for (int d = 0; d < sortedDT.Rows.Count; d++)
            {
                BQty = BQty + (Convert.ToDecimal(sortedDT.Rows[d]["Qty"].ToString()) - Convert.ToDecimal(sortedDT.Rows[d]["BQty"]));
                sortedDT.Rows[d]["Balance"] = BQty.ToString();
            }
        }
        gvgvStockregister.DataSource = sortedDT;
        gvgvStockregister.DataBind();
        decimal farmerCollTotal = dtCollect.AsEnumerable().Sum(m => m.Field <decimal>("Qty"));

        lblColleted.Text = Math.Round(farmerCollTotal, 1).ToString();
    }
Example #21
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Instrument != null)
         {
             hashCode = hashCode * 59 + Instrument.GetHashCode();
         }
         if (Qty != null)
         {
             hashCode = hashCode * 59 + Qty.GetHashCode();
         }
         if (Side != null)
         {
             hashCode = hashCode * 59 + Side.GetHashCode();
         }
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (FilledQty != null)
         {
             hashCode = hashCode * 59 + FilledQty.GetHashCode();
         }
         if (AvgPrice != null)
         {
             hashCode = hashCode * 59 + AvgPrice.GetHashCode();
         }
         if (LimitPrice != null)
         {
             hashCode = hashCode * 59 + LimitPrice.GetHashCode();
         }
         if (StopPrice != null)
         {
             hashCode = hashCode * 59 + StopPrice.GetHashCode();
         }
         if (ParentId != null)
         {
             hashCode = hashCode * 59 + ParentId.GetHashCode();
         }
         if (ParentType != null)
         {
             hashCode = hashCode * 59 + ParentType.GetHashCode();
         }
         if (Duration != null)
         {
             hashCode = hashCode * 59 + Duration.GetHashCode();
         }
         if (Status != null)
         {
             hashCode = hashCode * 59 + Status.GetHashCode();
         }
         return(hashCode);
     }
 }
Example #22
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Instrument == other.Instrument ||
                     Instrument != null &&
                     Instrument.Equals(other.Instrument)
                 ) &&
                 (
                     Qty == other.Qty ||
                     Qty != null &&
                     Qty.Equals(other.Qty)
                 ) &&
                 (
                     Side == other.Side ||
                     Side != null &&
                     Side.Equals(other.Side)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     FilledQty == other.FilledQty ||
                     FilledQty != null &&
                     FilledQty.Equals(other.FilledQty)
                 ) &&
                 (
                     AvgPrice == other.AvgPrice ||
                     AvgPrice != null &&
                     AvgPrice.Equals(other.AvgPrice)
                 ) &&
                 (
                     LimitPrice == other.LimitPrice ||
                     LimitPrice != null &&
                     LimitPrice.Equals(other.LimitPrice)
                 ) &&
                 (
                     StopPrice == other.StopPrice ||
                     StopPrice != null &&
                     StopPrice.Equals(other.StopPrice)
                 ) &&
                 (
                     ParentId == other.ParentId ||
                     ParentId != null &&
                     ParentId.Equals(other.ParentId)
                 ) &&
                 (
                     ParentType == other.ParentType ||
                     ParentType != null &&
                     ParentType.Equals(other.ParentType)
                 ) &&
                 (
                     Duration == other.Duration ||
                     Duration != null &&
                     Duration.Equals(other.Duration)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ));
        }
Example #23
0
        public string ToPostData(int index)
        {
            string postData = "";

            if (Name != null)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_NAME" + index.ToString()) + "=" + HttpUtility.UrlEncode(Name) + "&";
            }
            if (Desc != null)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_DESC" + index.ToString()) + "=" + HttpUtility.UrlEncode(Desc) + "&";
            }
            if (Amt != 0)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_AMT" + index.ToString()) + "=" + Amt.ToString("F", CultureInfo.InvariantCulture) + "&";
            }
            if (TaxAmt != 0)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_TAXAMT" + index.ToString()) + "=" + TaxAmt.ToString("F", CultureInfo.InvariantCulture) + "&";
            }
            if (Number != 0)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_NUMBER" + index.ToString()) + "=" + Number.ToString(CultureInfo.InvariantCulture) + "&";
            }
            if (Qty != 0)
            {
                postData += HttpUtility.UrlEncode("L_PAYMENTREQUEST_0_QTY" + index.ToString()) + "=" + Qty.ToString(CultureInfo.InvariantCulture) + "&";
            }
            return(postData);
        }
Example #24
0
 public override string ToString()
 {
     return($"Sell Item: {SellItem.ToString()} Qty: {Qty.ToString()}");
 }
Example #25
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //Disclaimers Start
            if (cboxTitle.Text == "" || cboxType.Text == "" || cboxAuthor.Text == "" || cboxGenre.Text == "" || txtPages.Text == "" || txtPrice.Text == "" || txtQty.Text == "" || txtPublisher.Text == "")
            {
                MessageBox.Show("Stock cannot be added because, one or many of the nessasary fields are left blank. Please fill all the fields and try again", "Field Left Blank", MessageBoxButtons.OK, MessageBoxIcon.Error); goto End;
            }

            //Remove single & double quotes which cause sql troubles
            foreach (Control c in this.Controls)
            {
                if (c is TextBox || c is ComboBox)
                {
                    c.Text = c.Text.Replace("'", ""); c.Text = c.Text.Replace("\"", "");
                }
            }

            int Qty; bool q = int.TryParse(txtQty.Text, out Qty);

            if (q == false)
            {
                MessageBox.Show("Insert a valid value for No. of books", "Invalid no. of books", MessageBoxButtons.OK, MessageBoxIcon.Error); goto End;
            }
            //Disclaimers End

            //Declarations
            string Title = cboxTitle.Text; string Maxbook = "B0000"; string BookID; double Price, Trans; Methods methods = new Methods();

            //When Creating new title.
            if (TitleNew == true)
            {
                //Disclaimer + integer Declarations

                int Pages; bool pg = int.TryParse(txtPages.Text, out Pages); bool p = double.TryParse(txtPrice.Text, out Price);
                if (q == false || p == false || pg == false)
                {
                    MessageBox.Show("Insert a valid value for No. of books, No. Pages or Price"); goto End;
                }


                //Declarations

                string Type, Author, Genre, ISBN, Publisher; TitleID = "";
                Author = cboxAuthor.Text; Genre = cboxGenre.Text; ISBN = txtISBN.Text; Publisher = txtPublisher.Text;

                if (cboxType.SelectedIndex == 0)
                {
                    Type = "CLend";
                }
                else if (cboxType.SelectedIndex == 1)
                {
                    Type = "ALend";
                }
                else
                {
                    Type = "Ref";
                }

                //Creating New TitleID
                {
                    //Getting MaxID from Databse
                    string       sqlMaxTitle = "SELECT MAX(TitleID) as MaxTitle, COUNT(TitleID) as CountID FROM Title";
                    OleDbCommand cmdMaxTitle = new OleDbCommand(sqlMaxTitle, db.con);
                    if (db.con.State.Equals(ConnectionState.Closed))
                    {
                        db.con.Open();
                    }
                    OleDbDataReader drMaxTitle = cmdMaxTitle.ExecuteReader(); drMaxTitle.Read();


                    //If there are titles in DB, formulate a new TitleID

                    if (drMaxTitle["CountID"].ToString() != "0")
                    {
                        // Calling NewID method
                        TitleID = methods.NewID(drMaxTitle["MaxTitle"].ToString());
                    }
                    else
                    {
                        TitleID = "T0001";
                    }
                }

                //Declartions End


                //Add Values to Relation: Title

                string       sqlTitleNew = string.Format("INSERT INTO Title(TitleID, BTitle, BType, Price, Genre, ISBN, Pg, Author, Publisher) VALUES('{0}', '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}', '{8}')", TitleID, Title, Type, Price, Genre, ISBN, Pages, Author, Publisher);
                OleDbCommand cmdTitleNew = new OleDbCommand(sqlTitleNew, db.con);
                if (db.con.State.Equals(ConnectionState.Closed))
                {
                    db.con.Open();
                }
                cmdTitleNew.ExecuteNonQuery();
            }
            else
            {
                Price = double.Parse(txtPrice.Text);
            }

            // Get the highest BookID from Database
            string       sqlMaxBook = "SELECT MAX(BookID) as MaxBook, COUNT(BookID) as CountID FROM Book";
            OleDbCommand cmdMaxBook = new OleDbCommand(sqlMaxBook, db.con);

            if (db.con.State.Equals(ConnectionState.Closed))
            {
                db.con.Open();
            }
            OleDbDataReader drMaxbook = cmdMaxBook.ExecuteReader(); drMaxbook.Read();

            if (drMaxbook["CountID"].ToString() != "0")
            {
                Maxbook = drMaxbook["MaxBook"].ToString();
            }
            else
            {
                Maxbook = "B0000";
            }

            // Adding books in a loop.

            for (int book = 1; book <= Qty; book++)
            {
                //Calling new ID method to create newID
                BookID = methods.NewID(Maxbook);

                //Adding a book with such book ID & TitleID to DB

                string       sqlbook = string.Format("INSERT INTO Book (BookID, TitleID) VALUES ('{0}','{1}')", BookID, TitleID);
                OleDbCommand cmdbook = new OleDbCommand(sqlbook, db.con);
                if (db.con.State.Equals(ConnectionState.Closed))
                {
                    db.con.Open();
                }
                cmdbook.ExecuteNonQuery();

                //Make the BookID as the new Book_MaxID to help the next loop
                Maxbook = BookID;
            }

            Maxbook = ""; BookID = "";


            // Adding Transaction details

            Trans = Price * Qty; string TDetail = string.Format("{0} books under the Title: {1}", Qty, Title);

            string       sqlTrans = string.Format("INSERT INTO Cash (TDate, Amount, TDetail, Event) VALUES('{0}', {1}, '{2}', 'NewStock')", DateTime.Now.ToString(), -Trans, TDetail);
            OleDbCommand cmdTrans = new OleDbCommand(sqlTrans, db.con);

            cmdTrans.ExecuteNonQuery();
            // Transactions added.

            //Successful Message
            MessageBox.Show(string.Format("{0} Book(s) and/or Book Title have been added to collection and transaction has been recorded successfully", Qty.ToString()), "Books Successfully Added", MessageBoxButtons.OK, MessageBoxIcon.Information);

            //Reset form
            this.Close(); frmAddBook f = new frmAddBook(); f.Show();

            End : if (db.con.State.Equals(ConnectionState.Open))
            {
                db.con.Close();
            }
        }
Example #26
0
        internal void AddNewSalesOrder()
        {
            ExcelLib.PopulateInCollection(InventoryTest.ExcelPath, "SalesOrderPage");
            //Navigate through Add Sales Order
            SalesMenu.Click();
            Thread.Sleep(1000);
            OrdersMenu.Click();
            Thread.Sleep(1000);
            AddSalesOrder.Click();
            Thread.Sleep(3000);

            //Add New Sales Order

            CustCode.Click();
            CustCode.SendKeys(ExcelLib.ReadData(2, "CustCode"));
            Thread.Sleep(2000);
            CustCodSelect.Click();
            Thread.Sleep(3000);
            CustRef.SendKeys(ExcelLib.ReadData(2, "CustRef"));
            Thread.Sleep(1000);
            Discount.Clear();
            Thread.Sleep(1000);
            Discount.SendKeys(ExcelLib.ReadData(2, "Discount"));
            Thread.Sleep(1000);

            Tax.SendKeys(ExcelLib.ReadData(2, "TaxRate"));
            Thread.Sleep(2000);

            //var TaxRate = CommonMethods.driver.FindElement(By.Id("SaleTaxes"));
            //var selectTaxRate = new SelectElement(TaxRate);
            //Thread.Sleep(3000);
            //selectTaxRate.SelectByText(ExcelLib.ReadData(2, "TaxRate"));

            //Warehouse.SendKeys(ExcelLib.ReadData(2,"Warehouse"));
            //Thread.Sleep(1000);
            var warehouse       = CommonMethods.driver.FindElement(By.Id("WarehouseList"));
            var selectWarehouse = new SelectElement(warehouse);

            Thread.Sleep(1000);
            selectWarehouse.SelectByText(ExcelLib.ReadData(2, "Warehouse"));


            //DeliveryMethod.SendKeys(ExcelLib.ReadData(2,"DeliveryMethod"));
            //Thread.Sleep(1000);
            var deliverymethod = CommonMethods.driver.FindElement(By.Id("DeliveryMethodList"));
            var selectDM       = new SelectElement(deliverymethod);

            Thread.Sleep(1000);
            selectDM.SelectByText(ExcelLib.ReadData(2, "DeliveryMethod"));

            DeliveryName.SendKeys(ExcelLib.ReadData(2, "DeliveryName"));
            Thread.Sleep(1000);
            DeliveryAdd.SendKeys(ExcelLib.ReadData(2, "StreetAddress"));
            Thread.Sleep(1000);
            DeliverySub.SendKeys(ExcelLib.ReadData(2, "Suburb"));
            Thread.Sleep(1000);
            DeliveryCity.SendKeys(ExcelLib.ReadData(2, "City"));
            Thread.Sleep(1000);
            Region.SendKeys(ExcelLib.ReadData(2, "Region"));
            Thread.Sleep(1000);
            PostCode.SendKeys(ExcelLib.ReadData(2, "PostCode"));
            Thread.Sleep(1000);
            DeliveryCountry.SendKeys(ExcelLib.ReadData(2, "Country"));
            Thread.Sleep(1000);

            SalesPerson.SendKeys(ExcelLib.ReadData(2, "SalesPerson"));
            Thread.Sleep(2000);
            //var sp = CommonMethods.driver.FindElement(By.Id("SalesPersonSelection"));
            //var selectsp = new SelectElement(sp);
            //Thread.Sleep(1000);
            //selectsp.SelectByText(ExcelLib.ReadData(2, "SalesPerson"));

            //SalesGrp.SendKeys(ExcelLib.ReadData(2, "SalesOrderGrp"));
            //Thread.Sleep(1000);
            var salesgroup     = CommonMethods.driver.FindElement(By.Id("SalesGroupList"));
            var selectsalesgrp = new SelectElement(salesgroup);

            Thread.Sleep(1000);
            selectsalesgrp.SelectByText(ExcelLib.ReadData(2, "SalesOrderGrp"));

            OrderDate.SendKeys(ExcelLib.ReadData(2, "OrderDate"));
            Thread.Sleep(1000);
            OrderDateSelect.Click();
            Thread.Sleep(1000);
            RequiredDate.SendKeys(ExcelLib.ReadData(2, "ReqDate"));
            Thread.Sleep(1000);
            RequiredDateSelect.Click();

            //InvoiceLayout.SendKeys(ExcelLib.ReadData(2, "SalesOrderTemp"));
            //Thread.Sleep(1000);

            var SalesorderTemp       = CommonMethods.driver.FindElement(By.Id("InvoiceLayoutId"));
            var selectSalesorderTemp = new SelectElement(SalesorderTemp);

            Thread.Sleep(1000);
            selectSalesorderTemp.SelectByText(ExcelLib.ReadData(2, "SalesOrderTemp"));

            //PackingSliplayout.SendKeys(ExcelLib.ReadData(2, "PackingSlipTemp"));
            //Thread.Sleep(1000);
            var PackingTemp       = CommonMethods.driver.FindElement(By.Id("InvoiceLayoutId"));
            var selectPackingTemp = new SelectElement(PackingTemp);

            Thread.Sleep(1000);
            selectPackingTemp.SelectByText(ExcelLib.ReadData(2, "PackingSlipTemp"));

            ProductLineAdd.SendKeys(ExcelLib.ReadData(2, "ProductLine"));
            Thread.Sleep(1000);
            Qty.SendKeys(ExcelLib.ReadData(2, "Qty"));
            Thread.Sleep(1000);
            Price.SendKeys(ExcelLib.ReadData(2, "LinePrice"));
            Thread.Sleep(1000);
            DeliverySub.SendKeys(ExcelLib.ReadData(2, "LineDiscount"));
            Thread.Sleep(1000);

            //Add sales order line to Order
            AddOrderLineBtn.Click();
            Thread.Sleep(1000);
            //Save Sales Order
            SaveSalesOrderBtn.Click();
            Thread.Sleep(1000);

            ViewSalesOrder.Click();
            Thread.Sleep(1000);
            //to filter data either can give cutomernumber or order number
            OrderNoFilter.SendKeys(SalesOrderNoDisplay.Text);
            Thread.Sleep(1000);
            OrderNoFilter.SendKeys(Keys.Enter);
            //filter byCust num
            CustFilter.SendKeys(ExcelLib.ReadData(2, "CustCode"));
            Thread.Sleep(1000);
            CustFilter.SendKeys(Keys.Enter);

            IList SalesOrderList      = CommonMethods.driver.FindElements(By.XPath(".//*[@id='SalesOrderList_tccell0_"));
            int   SalesOrderListCount = SalesOrderList.Count;

            //.//*[@id='SalesOrderList_tccell1_1']/a
            //.//*[@id='SalesOrderList_tccell2_1']/a

            //Verify added  Sales Order
            try
            {
                for (int i = 0; i <= SalesOrderListCount; i++)
                {
                    //Check whether the Salesorder is equal with grid table data
                    if (SalesOrderNoDisplay.Text == CommonMethods.driver.FindElement(By.XPath(".//*[@id='SalesOrderList_tccell[" + i + "]_1']/a ")).Text)
                    {
                        //Check whether the Salesorder is equal to actual
                        if (ExcelLib.ReadData(2, "CustCode") == CommonMethods.driver.FindElement(By.XPath(".//*[@id='SalesOrderList_tccell[" + i + "]_4']/a")).Text)
                        {
                            SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Found Added Sales Order");
                            Thread.Sleep(2000);
                        }
                    }
                    else
                    {
                        SaveScreenShotClass.SaveScreenshot(CommonMethods.driver, "Sales Order not found");
                        Thread.Sleep(2000);
                    }
                }
            }

            catch (Exception e)
            {
                Console.WriteLine("Can not find added Product,Test failed" + e.Message);
            }
        }