예제 #1
0
    public TenderQuotation getTenderQuotationByKey(string suppliercode, string itemcode)
    {
        TenderQuotation tq = sce.TenderQuotations.Where(x => x.suppliercode == suppliercode && x.itemcode == itemcode).FirstOrDefault();

        //TenderQuotation tq = sce.TenderQuotations.Where(x => x.itemcoditemcode) == .FirstOrDefault();

        return(tq);
    }
예제 #2
0
    public void updateTenderQuotation(TenderQuotation tq)
    {
        TenderQuotation tender = new TenderQuotation();

        tender       = getTenderQuotationByKey(tq.suppliercode, tq.itemcode);
        tender.price = tq.price;

        sce.SaveChanges();
    }
예제 #3
0
    protected void Save_Click(object sender, EventArgs e)
    {
        GridViewRow row             = GridView1.SelectedRow;
        string      itemdescription = row.Cells[0].Text;
        Item        i = scService.getItemByItemdescription(itemdescription);
        //i.itemdescription = TextBox1.Text;


        string   suppliername = DropDownList1.SelectedValue;
        Supplier s            = scService.getSupplierByName(suppliername);

        TenderQuotation tq = new TenderQuotation();

        tq.suppliercode = s.suppliercode;
        tq.itemcode     = i.itemcode;
        tq.price        = Convert.ToDouble(TextBox2.Text);
        //scService.updateTenderQuotation(i, tq);


        scService.updateTenderQuotation(tq);
        Response.Redirect("SCupdateTenderInformation.aspx");
    }
예제 #4
0
        public TenderQuotation GetFirstTenderbyProdutId(string ProductId)
        {
            DateTime now  = DateTime.Today;
            int      year = now.Year;

            try
            {
                TenderQuotation firsttq = (from tq in dbcontext.TenderQuotations
                                           where tq.ProductId == ProductId && tq.Year == year && tq.Rank != null
                                           orderby tq.Rank ascending
                                           select tq).Include(m => m.Product).Include(m => m.Supplier).Take(1).FirstOrDefault();
                if (firsttq == null)
                {
                    throw new Exception();
                }
                return(firsttq);
            }
            catch
            {
                throw new Exception("Error finding tender quotation by this product id");
            }
        }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IIdentity id = User.Identity;

        role = Convert.ToInt32(User.Identity.Name);
        if (GridView1.Rows.Count == 0)
        {
            //Button1.Visible = false;
            Button2.Visible = false;
        }
        if (!IsPostBack)
        {
            int sno = 1;
            ViewState["sno"] = sno;
            DataTable dt = new DataTable();
            ViewState["list"] = dt;
            DropDownList2.DataBind();
            DropDownList2.SelectedIndex = 0;
            Item item = sc.getsuppliercode(DropDownList2.SelectedValue);

            TenderQuotation price1 = sc.getprice(item.supplier1, DropDownList2.SelectedValue);
            Label4.Text = price1.price.ToString() + "(Unit Price)";
            TenderQuotation price2 = sc.getprice(item.supplier2, DropDownList2.SelectedValue);
            Label1.Text = price2.price.ToString() + "(Unit Price)";
            TenderQuotation price3 = sc.getprice(item.supplier3, DropDownList2.SelectedValue);
            Label5.Text = price3.price.ToString() + "(Unit price)";



            RadioButton1.Text    = item.supplier1;
            RadioButton2.Text    = item.supplier2;
            RadioButton3.Text    = item.supplier3;
            RadioButton2.Checked = false;
            RadioButton3.Checked = false;
            RadioButton1.Checked = true;
        }
    }
예제 #6
0
    protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
    {
        Item item = sc.getsuppliercode(DropDownList2.SelectedValue);


        TenderQuotation price1 = sc.getprice(item.supplier1, DropDownList2.SelectedValue);

        Label4.Text = price1.price.ToString() + "(Unit Price)";
        TenderQuotation price2 = sc.getprice(item.supplier2, DropDownList2.SelectedValue);

        Label1.Text = price2.price.ToString() + "(Unit Price)";
        TenderQuotation price3 = sc.getprice(item.supplier3, DropDownList2.SelectedValue);

        Label5.Text = price3.price.ToString() + "(Unit price)";



        RadioButton1.Text    = item.supplier1;
        RadioButton2.Text    = item.supplier2;
        RadioButton3.Text    = item.supplier3;
        RadioButton2.Checked = false;
        RadioButton3.Checked = false;
        RadioButton1.Checked = true;
    }
예제 #7
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        //Button1.Visible = true;
        Button2.Visible = true;
        Item item = sc.getsuppliercode(DropDownList2.SelectedValue);

        TenderQuotation price1 = sc.getprice(item.supplier1, DropDownList2.SelectedValue);

        TenderQuotation price2 = sc.getprice(item.supplier2, DropDownList2.SelectedValue);

        TenderQuotation price3 = sc.getprice(item.supplier3, DropDownList2.SelectedValue);

        // OrderItem order = sc.getorderquantity(DropDownList2.SelectedValue);
        int quantity = Convert.ToInt32(TextBox1.Text);
        //double qty = order.orderquantity;
        double cost;

        if (RadioButton1.Checked)
        {
            if (GridView1.Rows.Count == 0)
            {
                ViewState["sno"] = 1;
            }
            int sno = (int)ViewState["sno"];

            cost = price1.price;
            double    amount = quantity * cost;
            DataTable dt     = new DataTable();
            dt = (DataTable)ViewState["list"];
            if (dt.Rows.Count == 0)
            {
                dt.Columns.Add("S.no");
                dt.Columns.Add("Item Number");
                dt.Columns.Add("Description");
                dt.Columns.Add("Quantity");
                dt.Columns.Add("Price");
                dt.Columns.Add("Amount");
                dt.Columns.Add("Supplier");
                // dt.Columns.Add("Special Request");
            }
            dt.Rows.Add(sno, item.itemcode, item.itemdescription, quantity, price1.price, amount, item.supplier1);



            GridView1.DataSource = dt;
            GridView1.DataBind();

            ViewState["list"] = dt;

            sno++;
            ViewState["sno"] = sno;
        }
        else if (RadioButton2.Checked)
        {
            if (GridView1.Rows.Count == 0)
            {
                ViewState["sno"] = 1;
            }
            int sno = (int)ViewState["sno"];
            cost = price2.price;
            double    amount = quantity * cost;
            DataTable dt     = new DataTable();
            dt = (DataTable)ViewState["list"];

            if (dt.Rows.Count == 0)
            {
                dt.Columns.Add("S.no");
                dt.Columns.Add("Item Number");
                dt.Columns.Add("Description");
                dt.Columns.Add("Quantity");
                dt.Columns.Add("Price");
                dt.Columns.Add("Amount");
                dt.Columns.Add("Supplier");
                //  dt.Columns.Add("Special Request");
            }
            dt.Rows.Add(sno, item.itemcode, item.itemdescription, quantity, price2.price, amount, item.supplier2);
            GridView1.DataSource = dt;
            GridView1.DataBind();
            ViewState["list"] = dt;

            sno++;
            ViewState["sno"] = sno;
        }
        else if (RadioButton3.Checked)
        {
            if (GridView1.Rows.Count == 0)
            {
                ViewState["sno"] = 1;
            }
            int sno = (int)ViewState["sno"];
            cost = price3.price;
            double    amount = quantity * cost;
            DataTable dt     = new DataTable();
            dt = (DataTable)ViewState["list"];
            //int quant = Convert.ToInt32(TextBox1.Text);
            if (dt.Rows.Count == 0)
            {
                dt.Columns.Add("S.no");
                dt.Columns.Add("Item Number");
                dt.Columns.Add("Description");
                dt.Columns.Add("Quantity");
                dt.Columns.Add("Price");
                dt.Columns.Add("Amount");
                dt.Columns.Add("Supplier");
                //  dt.Columns.Add("Special Request");
            }
            dt.Rows.Add(sno, item.itemcode, item.itemdescription, quantity, price3.price, amount, item.supplier3);
            GridView1.DataSource = dt;
            GridView1.DataBind();
            ViewState["list"] = dt;

            sno++;
            ViewState["sno"] = sno;
        }
    }
예제 #8
0
    public TenderQuotation getprice(String suppliercode, String item)
    {
        TenderQuotation price = sce.TenderQuotations.Where(x => x.suppliercode == suppliercode && x.itemcode == item).First();

        return(price);
    }
예제 #9
0
 public void deleteTenderQuotation(TenderQuotation t)
 {
     sce.TenderQuotations.Remove(t);
     sce.SaveChanges();
 }
예제 #10
0
    public static double findTenderQuotation(string suppliercode, string itemcode)
    {
        TenderQuotation tq = ds.TenderQuotations.Where(x => x.suppliercode == suppliercode && x.itemcode == itemcode).First();

        return(tq.price);
    }
예제 #11
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        String actualqty;
        List <RequisitionItem> rlist   = new List <RequisitionItem>();
        List <Requisition>     reqlist = new List <Requisition>();
        string deptcode;

        deptcode = RadioButtonList1.SelectedValue;
        int approvercode = sc.getrepresentativecode(deptcode);

        // deptcode=sc.getdepartmentcode(deptname);
        rlist   = sc.getrequisitions(deptcode);
        reqlist = sc.getreq(deptcode);

        int allocated;



        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            String          suppliercode = "";
            TenderQuotation price        = new TenderQuotation();
            GridViewRow     row          = GridView1.Rows[i];
            String          itemcode     = GridView1.Rows[i].Cells[0].Text;
            TextBox         tx           = (TextBox)row.FindControl("Textfrom");
            allocated = Convert.ToInt32(GridView1.Rows[i].Cells[2].Text);
            actualqty = tx.Text;
            DropDownList supplier = (row.FindControl("MyDD") as DropDownList);
            if (!supplier.SelectedItem.Text.Equals("select"))
            {
                suppliercode = supplier.SelectedItem.Text;
                price        = sc.getprice(suppliercode, itemcode);
            }
            int actualquantity = Convert.ToInt32(actualqty);

            int disbursementid = Convert.ToInt32(GridView1.Rows[i].Cells[4].Text);
            if (allocated == actualquantity)
            {
                for (int j = 0; j < rlist.Count; j++)
                {
                    if (rlist[j].itemcode == itemcode)
                    {
                        sc.updatestatusto3(rlist[j].requisitionid, itemcode);
                        sc.updatedisbursement(disbursementid, itemcode, actualquantity);
                    }
                }
            }
            else if (allocated != actualquantity)
            {
                sc.addadjustmentvoucher(price.price, role, itemcode, allocated - actualquantity);
                for (int j = 0; j < rlist.Count; j++)
                {
                    if (rlist[j].itemcode == itemcode)
                    {
                        sc.deliverstatus(rlist[j].requisitionid, itemcode, allocated - actualquantity, actualquantity, deptcode, rlist[j].Requisition.employeecode);
                        sc.updatedisbursement(disbursementid, itemcode, actualquantity);
                    }
                }
            }
        }
        for (int z = 0; z < reqlist.Count; z++)
        {
            int reqcount    = sc.getreqcount(reqlist[z].requisitionid);
            int statuscount = sc.getstatuscount(reqlist[z].requisitionid);
            if (reqcount == statuscount)
            {
                sc.updaterequisition(reqlist[z].requisitionid);
            }
        }
        sc.updatedisb(deptcode);

        List <int>     dis      = sc.getdis(RadioButtonList1.SelectedValue);
        List <dynamic> disitems = new List <dynamic>();

        foreach (int i in dis)
        {
            List <dynamic> disitem = sc.getdisbursementitems(i).ToList();
            disitems.AddRange(disitem);
        }
        GridView1.DataSource = disitems;
        GridView1.DataBind();
    }