コード例 #1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            foreach (RepeaterItem item in rpAgentOrderdetails.Items)
            {
                TextBox     txtReceivedQty = item.FindControl("txtReceivedQty") as TextBox;
                TextBox     txtAcceptedQty = item.FindControl("txtAcceptedQty") as TextBox;
                TextBox     txtRejectedQty = item.FindControl("txtRejectedQty") as TextBox;
                Label       lblQuantity    = item.FindControl("lblQuantity") as Label;
                Label       lblPrice       = item.FindControl("lblPrice") as Label;
                Label       lbltotal       = item.FindControl("lbltotal") as Label;
                HiddenField hfItemId       = item.FindControl("hfItemId") as HiddenField;
                HiddenField hfId           = item.FindControl("hfOrderDetailsId") as HiddenField;
                HiddenField hfCst          = item.FindControl("hfCst") as HiddenField;
                HiddenField hfExcise       = item.FindControl("hfExcise") as HiddenField;
                HiddenField hfVat          = item.FindControl("hfVat") as HiddenField;
                if (hfId != null)
                {
                    mrnDetails   = new MRNDetails();
                    purchaseData = new PurchaseData();

                    mrnDetails.ItemId         = Convert.ToInt32(hfItemId.Value);
                    mrnDetails.OrderDetailsId = Convert.ToInt32(hfId.Value);
                    mrnDetails.OrderedQty     = Convert.ToDouble(lblQuantity.Text);
                    mrnDetails.ReceivedQty    = string.IsNullOrEmpty(txtReceivedQty.Text)? 0 : Convert.ToDouble(txtReceivedQty.Text);
                    mrnDetails.AcceptedQty    = string.IsNullOrEmpty(txtAcceptedQty.Text) ? 0 : Convert.ToDouble(txtAcceptedQty.Text);
                    mrnDetails.RejectedQty    = string.IsNullOrEmpty(txtRejectedQty.Text) ? 0 : Convert.ToDouble(txtRejectedQty.Text);
                    mrnDetails.Price          = Convert.ToDecimal(lblPrice.Text);
                    mrnDetails.Cst            = Convert.ToDouble(hfCst.Value);
                    mrnDetails.Excise         = Convert.ToDouble(hfExcise.Value);
                    mrnDetails.Vat            = Convert.ToDouble(hfVat.Value);
                    mrnDetails.Amount         = Convert.ToDecimal(lbltotal.Text);
                    mrnDetails.Flag           = 1;

                    purchaseData.MrnDML(mrnDetails);
                }
            }
            mrn             = new MRN();
            mrn.BillDate    = (Convert.ToDateTime(txtBillDate.Text)).ToString("dd-MM-yyyy");
            mrn.BillNo      = txtBillNumber.Text;
            mrn.VehicleNo   = txtVehicleNo.Text;
            mrn.PRNo        = txtPRNo.Text;
            mrn.RequiredFor = txtRequiredFor.Text;
            mrn.Remarks     = txtRemarks.Text;
            mrn.CreatedBy   = GlobalInfo.Userid;
            mrn.ReceivedBy  = Convert.ToInt32(dpReceivedBy.SelectedItem.Value);
            mrn.QCBy        = Convert.ToInt32(dpQcBy.SelectedItem.Value);
            mrn.FinMgr      = Convert.ToInt32(dpFinanceMgr.SelectedItem.Value);
            mrn.ApprovedBy  = Convert.ToInt32(dpApprovedBy.SelectedItem.Value);
            mrn.OrderId     = Convert.ToInt32(dpPOCode.SelectedItem.Value);
            mrn.TotalAmt    = Convert.ToDecimal(hftotalAmout.Value);

            bool result = purchaseData.MrnDML2(mrn);

            if (result)
            {
                ClearTexboxes();

                divDanger.Visible   = false;
                divwarning.Visible  = false;
                divSusccess.Visible = true;
                lblSuccess.Text     = "Material Received Note Submitted Successfully";
                pnlError.Update();
                upMain.Update();
            }
            else
            {
                divDanger.Visible   = false;
                divwarning.Visible  = true;
                divSusccess.Visible = false;
                lblwarning.Text     = "Please Contact to Site Admin";
                pnlError.Update();
            }
        }