예제 #1
0
        private void UpdateProcurementDetails()
        {
            DateTime?dtPurchaseOrderDate = null;
            DateTime?dtVendorOrderDate   = null;
            DateTime?dtApprovedOn        = null;
            DateTime?dtQuoteDate         = null;
            DateTime?dtWarrantyDate      = null;

            int intOrderID = Int32.Parse(hdnOrderId.Value);

            if (txtPurchaseOrderDate.Text.Trim() != "")
            {
                dtPurchaseOrderDate = DateTime.Parse(txtPurchaseOrderDate.Text.Trim());
            }

            if (txtVendorOrderDate.Text.Trim() != "")
            {
                dtVendorOrderDate = DateTime.Parse(txtVendorOrderDate.Text.Trim());
            }

            if (txtApprovedOn.Text.Trim() != "")
            {
                dtApprovedOn = DateTime.Parse(txtApprovedOn.Text.Trim());
            }

            if (txtQuoteDate.Text.Trim() != "")
            {
                dtQuoteDate    = DateTime.Parse(txtQuoteDate.Text.Trim());
                dtWarrantyDate = dtQuoteDate.Value.AddYears(3);
            }

            string strPurchaseOrderUpload = hypPurchaseOrderUpload.NavigateUrl;

            if (filPurchaseOrderUpload.FileName != "" && filPurchaseOrderUpload.PostedFile != null)
            {
                string strDirectory = oVariable.UploadsFolder() + "PROCURE\\";
                if (Directory.Exists(strDirectory) == false)
                {
                    Directory.CreateDirectory(strDirectory);
                }
                string strExtension = filPurchaseOrderUpload.PostedFile.FileName.Trim();
                strExtension           = strExtension.Substring(strExtension.LastIndexOf("."));
                strPurchaseOrderUpload = strDirectory + "Purchase_Order_" + intOrderID.ToString() + strExtension;
                filPurchaseOrderUpload.PostedFile.SaveAs(strPurchaseOrderUpload);
            }
            string strManufacturerQuoteUpload = hypManufacturerQuoteUpload.NavigateUrl;

            if (filManufacturerQuoteUpload.FileName != "" && filManufacturerQuoteUpload.PostedFile != null)
            {
                string strDirectory = oVariable.UploadsFolder() + "PROCURE\\";
                if (Directory.Exists(strDirectory) == false)
                {
                    Directory.CreateDirectory(strDirectory);
                }
                string strExtension = filManufacturerQuoteUpload.PostedFile.FileName.Trim();
                strExtension = strExtension.Substring(strExtension.LastIndexOf("."));
                strManufacturerQuoteUpload = strDirectory + "Manufacturer_Quote_" + intOrderID.ToString() + strExtension;
                filManufacturerQuoteUpload.PostedFile.SaveAs(strManufacturerQuoteUpload);
            }
            int intProjectID = 0;

            Int32.TryParse(Request.Form[hdnProjectId.UniqueID], out intProjectID);

            int intProjectManager = 0;

            Int32.TryParse(Request.Form[hdnProjectManager.UniqueID], out intProjectManager);

            if (intProjectManager > 0 && intProjectID > 0)
            {
                DataSet dsProject = oProject.Get(intProjectID);
                if (dsProject.Tables[0].Rows.Count == 1)
                {
                    int intLead = 0;
                    Int32.TryParse(dsProject.Tables[0].Rows[0]["lead"].ToString(), out intLead);
                    if (intLead == 0)
                    {
                        oProject.Update(intProjectID, intProjectManager, 0, 0, 0, 0, 0);
                    }
                }
            }

            int intAttentionTo = 0;

            Int32.TryParse(Request.Form[hdnAttentionTo.UniqueID], out intAttentionTo);

            float fltPurchaseOrderPrice = 0;

            float.TryParse(txtPurchaseOrderPrice.Text, out fltPurchaseOrderPrice);

            int intApprovedQuantity = 0;

            Int32.TryParse(txtApprovedQuantity.Text, out intApprovedQuantity);

            float fltSystemPrice = 0;

            float.TryParse(txtSystemPrice.Text, out fltSystemPrice);

            float fltSalesTax = 0;

            float.TryParse(txtSalesTax.Text, out fltSalesTax);

            oAssetOrder.UpdateProcurementDetails(
                Int32.Parse(hdnOrderId.Value),
                txtNickName.Text.Trim(),
                Int32.Parse(txtProcureQuantity.Text.Trim()),
                Int32.Parse(txtReDeployQuantity.Text.Trim()),
                Int32.Parse(txtReturnedQuantity.Text.Trim()),
                Int32.Parse(ddlPurchaseOrderStatus.SelectedValue),
                txtPurchaseOrderComments.Text.Trim(),
                dtPurchaseOrderDate,
                fltPurchaseOrderPrice,
                Int32.Parse(ddlVendorOrderStatus.SelectedValue),
                dtVendorOrderDate,
                txtVendorTrackingNumber.Text.Trim(),
                intProjectID,
                txtPurchaseOrderNumber.Text,
                intApprovedQuantity,
                dtApprovedOn,
                strPurchaseOrderUpload,
                txtQuoteNumber.Text,
                dtQuoteDate,
                dtWarrantyDate,
                fltSystemPrice,
                fltSalesTax,
                strManufacturerQuoteUpload,
                intAttentionTo,
                intProfile);
        }