コード例 #1
0
        public string CommitTransactoins(string ScaleObject, string TaskObject, string ScaleTestObject, string ReceiptObjct, string ManufacturerObject, string TestCheck, string ListName, string ReceiptFlag,
            string Qabannahobj, string QabannahDetailsobj, string QabannahSCaleobj, string ISNewManufacturere)
        {
            string TestGenerateID = "";
            string ReceiptGeneratedID = "";
            string Transactions = string.Empty;
            string[] Temp = TestCheck.Split(',');
            string VerficationType = Temp[0];
            string IsReVerificaiton = Temp[1];
            string TaskIDtoUpdate = Temp[2];
            string TestIDtoUpdate = Temp[3];
            string TaskIdGenerated = "";
            string url = "http://sp-app2-dev:35897/VIS-DEV/";

            string VerificationConductedBy = "";
            string CompanyId = "";
            string QCCTagNumber = "";
            string TradingLiecense = "";
            string TestType = "";

            string FinalTestResults = "";
            string ScaleManufacturer = "";
            string MarkNumber = "";
            string VerificationCharges = "";
            string TestDate = "";
            string ScaleClass = "";

            string VerificationTestID = string.Empty;
            JavaScriptSerializer jscript = new JavaScriptSerializer();
            string TestScaleIGenerated = "";

            try
            {

                ScaleTest ScaleTest = null;
                Qabannah Qabannah = null;
                jscript = new JavaScriptSerializer();
                if (ScaleTestObject.Length > 10)
                {
                    ScaleTest = jscript.Deserialize<ScaleTest>(ScaleTestObject);
                    VerificationConductedBy = ScaleTest.VerificationConductedBy;
                    CompanyId = ScaleTest.CompanyId;
                    QCCTagNumber = ScaleTest.QCCTagNumber;
                    TradingLiecense = ScaleTest.TradingLiecense;
                    TestType = ScaleTest.TestType;
                    VerificationCharges = ScaleTest.VerificationCharges;
                    TestDate = ScaleTest.TestDate;
                    ScaleClass = ScaleTest.ScaleCalss;
                    FinalTestResults = ScaleTest.FinalTestResults;
                    // if (FinalTestResult=="Pass" || FinalTestResult=="PASS")
                    // {
                    //  MarkNumber = ScaleTest.VerifiedMarck;
                    // }
                    // else
                    MarkNumber = ScaleTest.MarkNumber;
                }

                jscript = new JavaScriptSerializer();
                if (Qabannahobj.Length > 10)
                {
                    Qabannah = jscript.Deserialize<Qabannah>(Qabannahobj);
                    VerificationConductedBy = Qabannah.VerificationConductedBy;
                    CompanyId = Qabannah.CompanyId;
                    QCCTagNumber = Qabannah.QCCTagNumber;
                    TradingLiecense = Qabannah.TradingLiecense;
                    TestType = Qabannah.TestType;
                    VerificationCharges = Qabannah.VerificationCharges;
                    TestDate = Qabannah.TestDate;
                    ScaleClass = Qabannah.ScaleCalss;
                    MarkNumber = Qabannah.MarkNumber;
                    FinalTestResults = Qabannah.FinalTestResults;
                }

                if (ScaleObject.Length > 10)
                {
                    jscript = new JavaScriptSerializer();
                    Scale Scale = jscript.Deserialize<Scale>(ScaleObject);
                    if (IsReVerificaiton != "YES")
                    {
                        TestScaleIGenerated = FinallyAddingScales(Scale);
                    }
                    else
                    {
                        TestScaleIGenerated = Scale.ScaleOldId;
                    }
                }

                jscript = new JavaScriptSerializer();
                ScaleMainTask ScaleMainTask = jscript.Deserialize<ScaleMainTask>(TaskObject);

                jscript = new JavaScriptSerializer();
                if (ScaleTestObject.Length > 10)
                {
                    //ScaleTest ScaleTest = jscript.Deserialize<ScaleTest>(ScaleTestObject);
                    if (VerficationType == "YES")
                    {
                        // ScaleTest.TestType = "Re-Verification";

                    }
                    if (IsReVerificaiton == "YES")
                    {
                        // ScaleTest.TestType = "Re-Verification";

                    }
                    ScaleTest.TaskId = TaskIdGenerated;
                    ScaleTest.ScaleId = TestScaleIGenerated;
                    ScaleTest.ReVisited = "NO";
                    VerificationTestID = SavethWholeTest(ScaleTest);
                }

                jscript = new JavaScriptSerializer();
                Manufacturere Manufacturere = jscript.Deserialize<Manufacturere>(ManufacturerObject);

                if (QabannahSCaleobj.Length > 10)
                {
                    jscript = new JavaScriptSerializer();
                    QabanahScales QabanahScales = jscript.Deserialize<QabanahScales>(QabannahSCaleobj);
                    if (IsReVerificaiton != "YES")
                    {
                        TestScaleIGenerated = CreateQabannahScale(QabanahScales, url);
                    }
                    else
                    {
                        TestScaleIGenerated = QabanahScales.OldScaleId;
                    }

                }

                if (TaskIDtoUpdate == "NO" || TaskIDtoUpdate == "undefined")
                {
                    ScaleMainTask ms = new ScaleMainTask();
                    ms.AssignedTo = VerificationConductedBy;
                    ms.ContactN = "d";
                    ms.Contactp = "s";
                    ms.Description = "d";
                    ms.EntityName = CompanyId;
                    ms.QCCTagNumber = QCCTagNumber;
                    ms.Task_Location = "s";
                    ms.TradeLiecense = TradingLiecense;
                    ms.VerificationType = TestType;
                    TaskIdGenerated = CreateScaleMainTask(ms);
                }
                else
                {
                    //WE NEED TO UPDATE
                    TaskIdGenerated = TestScaleIGenerated;
                    UpdateScaleMainTask(TestScaleIGenerated);

                }

                if (Qabannahobj.Length > 10)
                {
                    //jscript = new JavaScriptSerializer();
                    // Qabannah = jscript.Deserialize<Qabannah>(Qabannahobj);
                    if (VerficationType == "YES")
                    {
                        //Qabannah.TestType = "Re-Verification";

                    }
                    if (IsReVerificaiton == "YES")
                    {
                        // Qabannah.TestType = "Re-Verification";

                    }
                    Qabannah.TaskId = TaskIdGenerated;
                    Qabannah.ScaleId = TestScaleIGenerated;
                    Qabannah.ReVisited = "NO";
                    VerificationTestID = SavetheWholeTestQabannah(Qabannah, url);

                }

                if (QabannahDetailsobj.Length > 10)
                {
                    jscript = new JavaScriptSerializer();
                    QabannahDetails QabannahDetails = jscript.Deserialize<QabannahDetails>(QabannahDetailsobj);
                    QabannahDetails.TestID = VerificationTestID;
                    string _qban = CreateQabannahDetail(QabannahDetails, url);
                }

                if (VerificationTestID != "")
                {

                    if (TaskIDtoUpdate == "NO" || TaskIDtoUpdate == "undefined")
                    {
                        ScaleMainTask ms = new ScaleMainTask();
                        ms.AssignedTo = VerificationConductedBy;
                        ms.ContactN = "d";
                        ms.Contactp = "s";
                        ms.Description = "d";
                        ms.EntityName = CompanyId;
                        ms.QCCTagNumber = QCCTagNumber;
                        ms.Task_Location = "s";
                        ms.TradeLiecense = TradingLiecense;
                        ms.VerificationType = TestType;
                        // TaskIdGenerated = CreateScaleMainTask(ms);
                    }
                    else
                    {
                        //WE NEED TO UPDATE
                        TaskIdGenerated = TestScaleIGenerated;
                        UpdateScaleMainTask(TestScaleIGenerated);

                    }

                    if (ISNewManufacturere == "YES")
                    {
                        Manufacturere.AddedBy = VerificationConductedBy;
                        // Manufacturere.Name = ScaleManufacturer;
                        url = "http://sp-app2-dev:35897/VIS-DEV/";
                        CreateManuFacturer(Manufacturere, url);
                    }

                    if (VerificationTestID != "")
                    {

                        if (IsReVerificaiton == "YES")
                        {

                            string ListNameDynamic = "";
                            if (VerficationType == "QABANAH")
                            {
                                ListNameDynamic = "Qabannah";
                            }
                            else
                            {
                                ListNameDynamic = "QCCScalesTests";
                            }
                            UpdateScaleTestAsReVisited(TestIDtoUpdate, ListNameDynamic);

                        }
                        QCCScalesReceipts _rcp = new QCCScalesReceipts();
                        _rcp.Company_Name = CompanyId;
                        _rcp.CompanyId = CompanyId;
                        _rcp.FinalTestResults = FinalTestResults;
                        _rcp.MarkNumber = MarkNumber;
                        _rcp.QCCTestId = TestScaleIGenerated;
                        _rcp.TaskId = "will be provide";
                        _rcp.Title = "s";
                        _rcp.TradingLiecense = TradingLiecense;
                        _rcp.VerificationCharges = VerificationCharges;
                        _rcp.VerificationDate = TestDate;
                        _rcp.WeightSetClass = ScaleClass;
                        ReceiptGeneratedID = CreateFinalReceipet(_rcp);
                    }

                }

            }
            catch (Exception ex)
            {

                throw;
            }
            Transactions = VerificationTestID + "," + ReceiptGeneratedID;
            return Transactions;
        }
コード例 #2
0
        public string CreateFinalReceipet(QCCScalesReceipts Receipt)
        {
            //use the JavaScriptSerializer to convert the string to a CompositeType instance
            // JavaScriptSerializer jscript = new JavaScriptSerializer();
            //QCCScalesReceipts Receipt = jscript.Deserialize<QCCScalesReceipts>(composite);
            //newComp.StringValue += " NEW!";
            //          return newComp;

            string url = "http://sp-app2-dev:35897/VIS-DEV/";

            string Result = "";
            try
            {
                using (ClientContext clientContext = new ClientContext(url))
                {
                    NetworkCredential credentials = new NetworkCredential("bot1", "12345678", "ADQCC");
                    clientContext.Credentials = credentials;
                    List oList = clientContext.Web.Lists.GetByTitle("QCCScalesReceipts");
                    ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
                    ListItem oListItem = oList.AddItem(itemCreateInfo);
                    oListItem["Title"] = Receipt.Title;
                    oListItem["Company_Name"] = Receipt.Company_Name;
                    oListItem["CompanyId"] = Receipt.CompanyId;
                    oListItem["FinalTestResults"] = Receipt.FinalTestResults;
                    oListItem["VerificationDate"] = Receipt.VerificationDate;
                    oListItem["WeightSetClass"] = Receipt.WeightSetClass;
                    oListItem["TradingLiecense"] = Receipt.TradingLiecense;
                    oListItem["TaskId"] = Receipt.TaskId;
                    oListItem["MarkNumber"] = Receipt.MarkNumber;
                    oListItem["QCCTestId"] = Receipt.QCCTestId;
                    oListItem["VerificationCharges"] = Receipt.VerificationCharges;

                    oListItem.Update();
                    clientContext.ExecuteQuery();
                    Result = Convert.ToString(oListItem.Id);
                }
            }
            catch (Exception ex)
            {

                throw;
            }
            return Result;
        }