コード例 #1
0
        protected void SaveRequest(int intStatus)
        {
            //Set Default Values For Request , Item , Number
            int    intServiceId   = 0;
            string strServerTitle = "";

            if (hdnRequestId.Value == "")
            {
                hdnRequestId.Value = "0";
            }
            if (hdnItemId.Value == "")
            {
                hdnItemId.Value = "0";
            }
            if (hdnNumber.Value == "")
            {
                hdnNumber.Value = "0";
            }



            if (Int32.Parse(rblOrderType.SelectedValue) == (int)AssetOrderType.Dispose)
            {
                hdnRackId.Value              = "0";
                ddlEnclosure.SelectedValue   = "0";
                txtEnclosureSlot.Text        = "0";
                ddlClass.SelectedValue       = "0";
                ddlEnvironment.SelectedValue = "0";
                hdnEnvironment.Value         = "0";
            }


            if (intStatus == (int)AssestOrderReqStatus.Active)
            {
                //Create new request
                int intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now);
                hdnRequestId.Value = intRequest.ToString();
            }

            //Add / Update Order Request
            if (hdnOrderId.Value == "")
            {
                int intOrderId = oAssetOrder.AddOrderId(intProfile);
                hdnOrderId.Value = intOrderId.ToString();

                oAssetOrder.AddOrder(Int32.Parse(hdnOrderId.Value),
                                     Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value),
                                     Int32.Parse(rblOrderType.SelectedValue),
                                     txtDescription.Text.Trim(),
                                     Int32.Parse(ddlModel.SelectedValue),
                                     0,
                                     0,
                                     (hdnAssetCategoryId.Value == "4"?Int32.Parse(hdnZoneId.Value):0),
                                     (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0),
                                     txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value),
                                     Int32.Parse(ddlClass.SelectedValue),
                                     Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")),
                                     Int32.Parse(ddlEnclosure.SelectedValue),
                                     (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0),
                                     Int32.Parse(txtQuantity.Text.Trim()),
                                     (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0),
                                     (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0,
                                     DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0),
                                     (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value),
                                     txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile);
            }
            else
            {
                if (intStatus == (int)AssestOrderReqStatus.UpdateOnly)
                {
                    // Get old status
                    intStatus = Int32.Parse(btnUpdate.CommandArgument);
                }
                oAssetOrder.UpdateOrder(Int32.Parse(hdnOrderId.Value),
                                        Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value),
                                        Int32.Parse(rblOrderType.SelectedValue),
                                        txtDescription.Text.Trim(),
                                        Int32.Parse(ddlModel.SelectedValue),
                                        0, 0,
                                        (hdnAssetCategoryId.Value == "4" ? Int32.Parse(hdnZoneId.Value) : 0),
                                        (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0),
                                        txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value),
                                        Int32.Parse(ddlClass.SelectedValue),
                                        Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")),
                                        Int32.Parse(ddlEnclosure.SelectedValue),
                                        (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0),
                                        Int32.Parse(txtQuantity.Text.Trim()),
                                        (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0),
                                        (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0,
                                        DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0),
                                        (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value),
                                        txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile);
            }

            //Added or deleted the assets to cv_asset_order_asset selection
            SaveAssetSelection(intStatus);

            //Add Commetns
            SaveReqComment();

            /* While finally submitting the request -
             * 1. For selected assets set  NewOrderId=RequestID
             * 2. If it's Re-Deployment clear the asset configuration
             * 3. If it's Asset Movement set Asset Attribute =Moving
             *
             */
            if (intStatus == (int)AssestOrderReqStatus.Active)
            {
                oAssetOrder.InitiateNextServiceRequestOrCompleteRequest(Int32.Parse(hdnOrderId.Value), 0, 0, true, dsnServiceEditor, intAssignPage, intViewPage, dsnAsset, dsnIP);
            }
        }