コード例 #1
0
        private void ClaimSelect(string name)
        {
            CleareAllViewClaimcontrols();
            MitchellClaimServiceReference.MitchellClaimServiceClient client = new MitchellClaimServiceReference.MitchellClaimServiceClient();
            DataSet result = client.SearchClaim(name);

            DataTable claimTable   = result.Tables[0];
            DataTable LossTable    = result.Tables[1];
            DataTable VehicleTable = result.Tables[2];

            if (claimTable.Rows.Count > 0)
            {
                txtClaimNumberView.Text     = claimTable.Rows[0]["ClaimNumber"].ToString();
                txtFnameView.Text           = claimTable.Rows[0]["ClaimantFirstName"].ToString();
                txtLnameView.Text           = claimTable.Rows[0]["ClaimantLastName"].ToString();
                ddlStatusView.SelectedValue = claimTable.Rows[0]["Status"].ToString();
                lossDatePickerView.Text     = claimTable.Rows[0]["LossDate"].ToString();
                txtAdjusterIdView.Text      = claimTable.Rows[0]["AssignedAdjusterID"].ToString();
            }
            if (LossTable.Rows.Count > 0)
            {
                ddlLossCauseView.SelectedValue = LossTable.Rows[0]["LossCause"].ToString();
                txtreportedDateView.Text       = LossTable.Rows[0]["ReportedDate"].ToString();
                txtDescriptionView.Text        = LossTable.Rows[0]["LossDescription"].ToString();
            }
            if (VehicleTable.Rows.Count > 0)
            {
                GridView3.DataSource = VehicleTable;
                GridView3.DataBind();
            }
            Tab2.CssClass            = "Clicked";
            MainView.ActiveViewIndex = 2;
        }
コード例 #2
0
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            MitchellClaimServiceReference.MitchellClaimServiceClient client = new MitchellClaimServiceReference.MitchellClaimServiceClient();
            DateTime fromDate = Convert.ToDateTime(txtFromDate.Text);
            DateTime toDate   = Convert.ToDateTime(txtToDate.Text);
            DataSet  result   = client.GetClaim(fromDate, toDate);

            GridView2.DataSource = result.Tables[0];
            GridView2.DataBind();
        }
コード例 #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            MitchellClaimServiceReference.ClaimInfo          claim = new MitchellClaimServiceReference.ClaimInfo();
            MitchellClaimServiceReference.VehicleInfo        vehicle;
            List <MitchellClaimServiceReference.VehicleInfo> vehicleList = new List <MitchellClaimServiceReference.VehicleInfo>();

            claim.lossInfo = new MitchellClaimServiceReference.LossInfo();

            claim.ClaimNumber = txtClaimNumber.Text;
            claim.Firstname   = txtFname.Text;
            claim.LastName    = txtLname.Text;
            claim.Status      = string.IsNullOrEmpty(ddlStatus.SelectedValue) ? null : ddlStatus.SelectedValue;
            claim.LossDate    = (string.IsNullOrEmpty(lossDatePicker.Text)) ? (DateTime?)null : DateTime.Parse(lossDatePicker.Text);
            claim.AdjusterId  = string.IsNullOrEmpty(txtAdjusterId.Text) ? (Int64?)null : Convert.ToInt64(txtAdjusterId.Text);

            claim.lossInfo.LossCause    = string.IsNullOrEmpty(ddlLossCause.SelectedValue) ? null : ddlLossCause.SelectedValue;
            claim.lossInfo.ReportedDate = (string.IsNullOrEmpty(txtreportedDate.Text)) ? (DateTime?)null : DateTime.Parse(txtreportedDate.Text);
            claim.lossInfo.Description  = txtDescription.Text;

            DataTable dt = (DataTable)ViewState["CurrentTable"];


            if (dt.Rows.Count > 0)
            {
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    vehicle           = new MitchellClaimServiceReference.VehicleInfo();
                    vehicle.ModelYear = string.IsNullOrEmpty(dt.Rows[i]["Year"].ToString()) ? (int?)null : Convert.ToInt16(dt.Rows[i]["Year"]);
                    vehicle.Model     = dt.Rows[i]["Model"].ToString();
                    vehicle.Engine    = dt.Rows[i]["Engine"].ToString();
                    vehicle.color     = dt.Rows[i]["Color"].ToString();
                    vehicle.Vin       = dt.Rows[i]["Vin"].ToString();
                    vehicle.LicPlate  = dt.Rows[i]["LicPlate"].ToString();
                    vehicle.State     = dt.Rows[i]["LicState"].ToString();
                    vehicle.ExpDate   = (string.IsNullOrEmpty(dt.Rows[i]["LicExpDate"].ToString())) ? (DateTime?)null : DateTime.Parse(dt.Rows[i]["LicExpDate"].ToString());
                    vehicle.Damage    = dt.Rows[i]["Damage"].ToString();
                    vehicle.Mileage   = string.IsNullOrEmpty(dt.Rows[i]["Mileage"].ToString()) ? (int?)null : Convert.ToInt16(dt.Rows[i]["Mileage"]);
                    vehicleList.Add(vehicle);
                }
            }

            claim.vehicleInfoList = vehicleList.ToArray();

            MitchellClaimServiceReference.MitchellClaimServiceClient client = new MitchellClaimServiceReference.MitchellClaimServiceClient();
            string result = client.CreateClaim(claim);

            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + result + "');", true);
            CleareAllAddClaimcontrols();
            DisplayClaimClick();


            //string baseAddress = "http://*****:*****@"C:\Users\HP-Coconut\Documents\Visual Studio 2015\Projects\MitchellClaim\MitchellClaimClient\createClaim.xml");

            // request.Method = "POST";
            // request.ContentType = "text/xml";
            // request.Headers.Add("SOAPAction", "http://tempuri.org/IMitchellClaimService/CreateClaim");
            // // set content length
            //// request.ContentLength = data.Length;
            // // get stream data out of webrequest object
            // Stream newStream = request.GetRequestStream();
            // doc.Save(newStream);
            //// newStream.Write(data, 0, data.Length);
            // newStream.Close();


            //HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:57108/MitchellClaimService.svc");
            //string data = "<?xml version=\"1.0\" encoding=\"utf-8\"?><s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Header></s:Header><s:Body><CreateClaim xmlns=\"http://tempuri.org/\"><ClaimNumber>WCFPOSTString</ClaimNumber></CreateClaim></s:Body></s:Envelope>";
            //XmlDocument doc = new XmlDocument();
            //doc.LoadXml(data);
            //request.Method = "POST";
            //request.ContentType = "text/xml;charset=utf-8";
            //request.KeepAlive = false;
            ////request.ProtocolVersion = HttpVersion.Version11;
            //request.Headers.Add("SOAPAction", "http://tempuri.org/IMitchellClaimService/CreateClaim");
            //Stream stream = request.GetRequestStream();
            //doc.Save(stream);
            //stream.Close();
            //try
            //{
            //    //Gets the response
            //    HttpWebResponse myHttpWebResponse = (HttpWebResponse)request.GetResponse();
            //    //Writes the Response
            //    Stream responseStream = myHttpWebResponse.GetResponseStream();

            //    StreamReader sr = new StreamReader(responseStream);
            //    string s = sr.ReadToEnd();
            //}
            //catch (WebException webex)
            //{
            //    WebResponse errResp = webex.Response;
            //    using (Stream respStream = errResp.GetResponseStream())
            //    {
            //        StreamReader reader = new StreamReader(respStream);
            //        string text = reader.ReadToEnd();
            //    }
            //}
        }