Exemplo n.º 1
0
        private void SetSelectedValue(List <Branch> branchList)
        {
            Service_db service = new Service_db();


            string branchId = service.ReadBranchFromLogFile();

            if (branchId == null || branchId == "")
            {
                MyMessageBox.ShowBox("Branch is not set, please contact to admistrator.");
                lblSelectedBranch.Text = "Select Branch";
            }

            cmbBranch.SelectedValue = branchId == "" ? 0 : Convert.ToInt32(branchId);

            if (branchId != "" && Convert.ToInt32(branchId) > 0)
            {
                cmbBranch.Visible = false;
                lblBranch.Visible = false;

                var branchDetial = branchList.FirstOrDefault(c => c.Id == Convert.ToInt32(branchId));

                if (branchDetial != null)
                {
                    lblSelectedBranch.Text = branchDetial.BranchName;
                }
                else
                {
                    lblSelectedBranch.Text = "Select Branch";
                }
            }
        }
Exemplo n.º 2
0
        public void SaveCertSerialNum(CertSerialNoDetailModel model)
        {
            if (model.VehicleId != 0)
            {
                var client  = new RestClient(IceCashRequestUrl + "SaveCertSerialNum");
                var request = new RestRequest(Method.POST);
                request.AddHeader("cache-control", "no-cache");
                request.AddHeader("content-type", "application/json");
                request.AddHeader("password", "Geninsure@123");
                request.AddHeader("username", "*****@*****.**");
                request.RequestFormat = DataFormat.Json;
                request.AddJsonBody(model);

                //request.Timeout = 5000;
                //request.ReadWriteTimeout = 5000;
                IRestResponse response = client.Execute(request);


                try
                {
                    Service_db service  = new Service_db();
                    string     branchId = service.ReadBranchFromLogFile();


                    var           apiStock     = new RestClient("http://api.gene.co.zw/inventory/api/paper/usage/" + branchId + "/" + model.CertSerialNo + "");
                    var           stockRequest = new RestRequest(Method.GET);
                    IRestResponse responseAPI  = apiStock.Execute(stockRequest);
                }
                catch (Exception e)
                {
                }
            }
        }