Esempio n. 1
0
        protected void popupComparePL_WindowCallback(object source, PopupWindowCallbackArgs e)
        {
            if (e.Parameter == "compare")
            {
                int modelId          = Session["ModelId"].ToInt32(0);
                int packingMonth     = txtActPM.ToInt32(0);
                int prevPackingMonth = cmbPrevPM.Value.ToInt32(0);
                int ricType          = cmbRicType.Value.ToInt32(0);

                bool status = RicRepository.ComparePackingList(modelId, ricType, packingMonth, prevPackingMonth);

                if (status)
                {
                    lblSuccess_Compare.Text = "Successfully compare packing month " + packingMonth + " with packing month " + prevPackingMonth;
                }
            }
            else
            {
                string[] arr = e.Parameter.Split(GridViewHelper.SEPARATOR_VALUES);
                if (arr.Length < 1)
                {
                    return;
                }

                int instanceStepId = arr[0].ToInt32(0);

                ChecklistInstanceStep step = ChecklistHelper.GetChecklistStep(instanceStepId);
                if (step == null || step.ChecklistInstance == null)
                {
                    return;
                }

                // get parameter
                DateTime dt           = DateTime.Parse(ChecklistHelper.GetChecklistParameterValue(step.ChecklistInstanceId, "PackingMonth"));
                int      packingMonth = dt.ToString("yyyyMM").ToInt32(0);
                int      modelId      = ChecklistHelper.GetChecklistParameterValue(step.ChecklistInstanceId, "CatalogModelId").ToInt32(0);

                txtActPM.Value = packingMonth.ToString();
                //txtModelId_Compare.Value = modelId.ToString();

                Session["ModelId"] = modelId;

                SqlDataSource sds = cmbPrevPM.DataSource as SqlDataSource;
                sds.SelectParameters["ModelId"].DefaultValue      = modelId.ToString();
                sds.SelectParameters["PackingMonth"].DefaultValue = packingMonth.ToString();
                cmbPrevPM.DataBind();

                cmbPrevPM.SelectedIndex = 0;
            }
        }
        private async Task StandartCheckJsonFile(string segmentOfConfig)
        {
            // Arrange
            JObject expected = ChecklistHelper.GetJson(checkingFile(segmentOfConfig));
            // Act
            RouteHelper testHelper = RouteHelper.Create();
            // Send a request asynchronously and continue when complete
            HttpResponseMessage response = await testHelper._client.GetAsync(checkingUrl(segmentOfConfig));

            // Assert
            StandartAnswerCheck(response);
            string  result = response.Content.ReadAsStringAsync().Result;
            JObject actual = JObject.Parse(result);

            AssertHelper.JsonEqual(expected, actual);
        }
Esempio n. 3
0
        protected void popupDocUpload_OnWindowCallback(object source, PopupWindowCallbackArgs e)
        {
            if (e.Parameter == "upload")
            {
                string filePath = Session["pl_uploaded_file"] as string;

                PackingListUploader uploader = new PackingListUploader();

                //set username for column createdby and modifiedby
                uploader.Username = PermissionHelper.GetAuthenticatedUserName();

                //parameter
                //DateTime value = (DateTime) dtPM.Value;
                int packingMonth = Session["PM"].ToInt32(0);
                int modelId      = Session["ModelId"].ToInt32(0);
                int ricType      = cmbRicType.Value.ToInt32(0);

                //parse the file
                string message  = "";
                int    rowCount = uploader.Parse(filePath, packingMonth, modelId, ricType);
                if (rowCount > 0)
                {
                    lblSuccess.Text = "Successfully upload and process data " + Path.GetFileName(filePath) + ", " + rowCount + " rows inserted, " + message;

                    //this.masterGrid.DataBindSafe();

                    int stepId = Session["StepId"].ToInt32(0);
                    ChecklistHelper.ReleaseStep(stepId);

                    string       gridName = Session["StepGrid"].ToString();
                    ASPxGridView grid     = this.Page.FindNestedControl2(gridName) as ASPxGridView;
                    if (grid != null)
                    {
                        grid.DataBindSafe();
                    }
                }
                else
                {
                    if (uploader.ErrorMessage.Length > 0)
                    {
                        lblSuccess.Text = uploader.ErrorMessage;
                    }
                    else
                    {
                        lblSuccess.Text = "Upload file " + Path.GetFileName(filePath) + " failed!";
                    }
                    //delete the file
                    File.Delete(filePath);

                    //e.CallbackData = lblSuccess.Text;

                    //e.IsValid = false;
                    //e.ErrorText = lblSuccess.Text;
                }
            }
            else
            {
                string[] arr = e.Parameter.Split(GridViewHelper.SEPARATOR_VALUES);
                if (arr.Length < 1)
                {
                    return;
                }

                int    instanceStepId = arr[0].ToInt32(0);
                string gridName       = arr[1];

                ChecklistInstanceStep step = ChecklistHelper.GetChecklistStep(instanceStepId);
                if (step == null || step.ChecklistInstance == null)
                {
                    return;
                }

                // get parameter
                DateTime dt           = DateTime.Parse(ChecklistHelper.GetChecklistParameterValue(step.ChecklistInstanceId, "PackingMonth"));
                int      packingMonth = dt.ToString("yyyyMM").ToInt32(0);
                int      modelId      = ChecklistHelper.GetChecklistParameterValue(step.ChecklistInstanceId, "CatalogModelId").ToInt32(0);

                Session["PM"]       = packingMonth;
                Session["ModelId"]  = modelId;
                Session["StepId"]   = instanceStepId;
                Session["StepGrid"] = gridName;

                lblSuccess.Text = "";
                //txtPM.Value = packingMonth.ToString();
                //txtModelId.Value = modelId;
                ////cmbRicType.Value = 0;
            }
        }
 public ODataIntegrationTest()
 {
     _configTest = ChecklistHelper.GetJson("__ConfigTest.json");
 }