public string FinallyAddingScales(Scale Scale)
        {
            string Result = "-1";
            //   JavaScriptSerializer jscript = new JavaScriptSerializer();
            //  Scale Scale = jscript.Deserialize<Scale>(composite);
            string url = "http://sp-app2-dev:35897/VIS-DEV/";
            //using (ClientContext clientContext = new ClientContext(url))
            try
            {
                using (ClientContext clientContext = new ClientContext(url))
                {
                    NetworkCredential credentials = new NetworkCredential("bot1", "12345678", "ADQCC");
                    clientContext.Credentials = credentials;
                    List oList = clientContext.Web.Lists.GetByTitle("QCCScales");
                    ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
                    ListItem oListItem = oList.AddItem(itemCreateInfo);
                    oListItem["Title"] = "VIS-Inspection-Scales";
                    oListItem["ScManufacturer"] = Scale.ScManufacturer;
                    oListItem["ScSerialNo"] = Scale.ScSerialNo;
                    oListItem["ScTypeApproval"] = Scale.ScTypeApproval;
                    oListItem["ScNumberofDisplay"] = Scale.ScNumberofDisplay;
                    oListItem["ScMax"] = Scale.ScMax;
                    oListItem["ScMin"] = Scale.ScMin;
                    oListItem["ScalVe"] = Scale.ScalVe;
                    oListItem["ScalVd"] = Scale.ScalVd;
                    oListItem["ScaleClass"] = Scale.ScaleClass;
                    oListItem["QCCTagNumber"] = Scale.QCCTagNumber;
                    oListItem["BusinessCategory"] = Scale.BusinessCategory;
                    oListItem["ScaleRangeUsed"] = Scale.ScaleRangeUsed;
                    oListItem["ScaleCategory"] = Scale.ScaleCategory;
                    oListItem["ScaleMiniMum"] = Scale.ScaleMiniMum;
                    oListItem["ScModel"] = Scale.ScModel;
                    oListItem["CalculationType"] = Scale.CalculationType;
                    oListItem["CompanyId"] = Scale.CompanyId;
                    oListItem["Maximum2"] = Scale.Maximum2;
                    oListItem["eval2"] = Scale.eval2;
                    oListItem["ScalVd2"] = Scale.ScalVd2;
                    oListItem["E_Unit"] = Scale.E_Unit;
                    oListItem.Update();
                    clientContext.ExecuteQuery();
                    Result = Convert.ToString(oListItem.Id);
                }
            }
            catch (Exception ex)
            {

                throw;
            }
            return Result;
        }
        public Scale GetScaleDetailInformatoin(string ScaleID)
        {
            Scale _MainObject = new Scale();
            string Result = string.Empty;
            try
            {
                string url = "http://*****:*****@"<View> <Query>  <Where><Eq><FieldRef Name='ID' />    <Value Type='Counter'>" + ScaleID + "</Value></Eq></Where>  "
                     + "</Query>"
                     + "<ViewFields>"
                    + "<FieldRef Name= 'ScMax' />< FieldRef Name='ScalVe' /><FieldRef Name = 'ScalVd' /> "
                     + "<FieldRef Name='Maximum2' /><FieldRef Name='eval2' /><FieldRef Name='ScaleRangeUsed' /><FieldRef Name='ScaleClass' />"
                     + "<FieldRef Name='CalculationType' /><FieldRef Name='QCCTagNumber' /><FieldRef Name='ScaleCategory' /><FieldRef Name='ScMin' /></ViewFields>  "
                     + "</View>";
                    ListItemCollection listItems = spList.GetItems(camlQuery);
                    clientContext.Load(listItems);
                    clientContext.ExecuteQuery();
                    foreach (ListItem item in listItems)
                    {
                        _MainObject.ScMax = Convert.ToString(item["ScMax"]);
                        _MainObject.BusinessCategory = Convert.ToString(item["BusinessCategory"]);
                        _MainObject.CalculationType = Convert.ToString(item["CalculationType"]);
                        _MainObject.CompanyId = Convert.ToString(item["CompanyId"]);
                        _MainObject.E_Unit = Convert.ToString(item["E_Unit"]);
                        _MainObject.eval2 = Convert.ToString(item["eval2"]);
                        _MainObject.Maximum2 = Convert.ToString(item["Maximum2"]);
                        _MainObject.QCCTagNumber = Convert.ToString(item["QCCTagNumber"]);
                        _MainObject.ScaleCategory = Convert.ToString(item["ScaleCategory"]);
                        _MainObject.ScaleClass = Convert.ToString(item["ScaleClass"]);
                        _MainObject.ScaleMiniMum = Convert.ToString(item["ScaleMiniMum"]);
                        _MainObject.ScaleOldId = Convert.ToString(item["ScaleOldId"]);
                        _MainObject.ScaleRangeUsed = Convert.ToString(item["ScaleRangeUsed"]);
                        _MainObject.ScalVd = Convert.ToString(item["ScalVd"]);
                        _MainObject.ScalVd2 = Convert.ToString(item["ScalVd2"]);
                        _MainObject.ScalVe = Convert.ToString(item["ScalVe"]);
                        _MainObject.ScManufacturer = Convert.ToString(item["ScManufacturer"]);
                        _MainObject.ScMin = Convert.ToString(item["ScMin"]);
                        _MainObject.ScModel = Convert.ToString(item["ScModel"]);
                        _MainObject.ScNumberofDisplay = Convert.ToString(item["ScNumberofDisplay"]);
                        _MainObject.ScSerialNo = Convert.ToString(item["ScSerialNo"]);
                        _MainObject.ScTypeApproval = Convert.ToString(item["ScTypeApproval"]);

                    }
                }
            }
            catch (Exception Ex)
            {

                // throw;

            }
            return _MainObject;
        }