protected void Operation_Click(object sender, EventArgs e) { try { if (Validation()) { if (btn_AddEmployeeLevel.InnerText.Trim() == "Add") { using (var client = new HttpClient()) { EmployeeLevelInsert p = new EmployeeLevelInsert { levelCode = txt_EmpLevelCode.Value.ToString().Trim(), levelDesc = txt_EmpLevelDesc.Value.ToString().Trim(), levelSequence = txt_EmpLevelSequence.Value.ToString().Trim(), levelSpa = chkAllowAllSpa.Checked, levelIsActive = chkActive.Checked, getGroupComm = false, minTarget = "0", fromSalary = "0", toSalary = "0" }; client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PostAsJsonAsync <EmployeeLevelInsert>("api/EmpLevels", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { var a = response.Content.ReadAsStringAsync().Result; CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a); ControlNosUpdate c = new ControlNosUpdate { controldescription = "EmpLevel Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(txt_EmpLevelCode.Value.ToString()) + 1)) }; string api = "api/ControlNos/updatecontrol"; post = client.PostAsJsonAsync <ControlNosUpdate>(api, c); post.Wait(); response = post.Result; if (response.IsSuccessStatusCode) { txt_EmpLevelCode.Value = Convert.ToString((Int64.Parse(txt_EmpLevelCode.Value.ToString()) + 1)); } oCommonEngine.SetAlert(this.Page, "Employee Level Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } else { using (var client = new HttpClient()) { EmployeeLevelUpdate p = new EmployeeLevelUpdate { id = int.Parse(Session["id"].ToString()), levelCode = txt_EmpLevelCode.Value.ToString().Trim(), levelDesc = txt_EmpLevelDesc.Value.ToString().Trim(), levelSequence = txt_EmpLevelSequence.Value.ToString().Trim(), levelSpa = chkAllowAllSpa.Checked, levelIsActive = chkActive.Checked, getGroupComm = false, minTarget = "0", fromSalary = "0", toSalary = "0" }; client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PutAsJsonAsync <EmployeeLevelUpdate>("api/EmpLevels", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Employee Level Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } Get_ControlPrefixs(); } } DataClear(); Get_EmpLevels(); } } catch (Exception Ex) { oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } }
protected void Operation_Click(object sender, EventArgs e) { try { //LoadHTMLTable(); bool xSuccess = false; int xClassid = 0; if (Validation()) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); //Save if (btnOperation.InnerText.Trim() == "Add") { CustomerClasses p = new CustomerClasses { classCode = txtCode_CustomerClass.Value.ToString().Trim(), classDesc = txtName_CustomerClass.Value.ToString().Trim(), classIsactive = (!chkInActive_CustomerClass.Checked), classProduct = 0, classService = 0 }; var post = client.PostAsJsonAsync <CustomerClasses>("api/CustomerClasses", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { var a = response.Content.ReadAsStringAsync().Result; CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a); xClassid = customerClassesUpdates.id; ControlNosUpdate c = new ControlNosUpdate { controldescription = "Customer Class Code", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(_ControlNo) + 1)) }; string api = "api/ControlNos/updatecontrol"; post = client.PostAsJsonAsync <ControlNosUpdate>(api, c); post.Wait(); response = post.Result; if (response.IsSuccessStatusCode) { xSuccess = true; Response.Redirect("CustomerMaster.aspx"); } } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } else //Update { CustomerClassUpdate p = new CustomerClassUpdate { classCode = txtCode_CustomerClass.Value.ToString().Trim(), classDesc = txtName_CustomerClass.Value.ToString().Trim(), classIsactive = (!chkInActive_CustomerClass.Checked), classProduct = 0, classService = 0, id = Int32.Parse(_PKey) }; xClassid = Int32.Parse(_PKey); var post = client.PutAsJsonAsync <CustomerClassUpdate>("api/CustomerClasses", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { xSuccess = true; //string api = "api/Departmentaldiscounts/10"; //post = client.DeleteAsync(api); //post.Wait(); //response = post.Result; //if (response.IsSuccessStatusCode) //{ // xSuccess = true; //} } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } if (xSuccess) { if (btnOperation.InnerText.Trim() == "Add") { oCommonEngine.SetAlert(this.Page, "Customer Class Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); Session["AlertMessage"] = "Customer Class Created Sucessfully...!"; txtCode_CustomerClass.Value = Convert.ToString((Int64.Parse(_ControlNo) + 1)); txtName_CustomerClass.Value = string.Empty; LoadDepartments(); } else { Session["AlertMessage"] = "Customer Class " + " Updated Sucessfully...!"; Response.Redirect("CustomerMaster.aspx?PKey=CLASS"); } } } } } catch (Exception Ex) { oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } }
protected void Operation_Click(object sender, EventArgs e) { try { if (Validation()) { if (btn_AddRoom.InnerText.Trim() == "Add") { using (var client = new HttpClient()) { RoomsList p = new RoomsList { roomCode = txtCode_Room.Value.ToString().Trim(), siteCode = ddlSiteCode_Room.Value.ToString().Trim(), description = txteDesc_Room.Value.ToString().Trim(), displayname = txt_RoomNo.Value.ToString().Trim(), // equipment = ddlEquipment.Value.ToString().Trim(), isactive = chkRoomActive_Room.Checked, }; System.Collections.Generic.List <string> sc = new System.Collections.Generic.List <string>(); foreach (ListItem item in ddlEquipment.Items) { if (item.Selected) { sc.Add(item.Text); } } string csv = String.Join("/", sc.ToArray()); // csv = ddlEquipment.Value.ToString().Trim(); p.equipment = csv; if (rbtn_SingleRoom.Checked) { p.roomtype = rbtn_SingleRoom.Value.ToString().Trim(); } else if (rbtn_Double.Checked) { p.roomtype = rbtn_Double.Value.ToString().Trim(); } else if (rbtn_TripleRoom.Checked) { p.roomtype = rbtn_TripleRoom.Value.ToString().Trim(); } else if (rbtn_QuadRoom.Checked) { p.roomtype = rbtn_QuadRoom.Value.ToString().Trim(); } else if (rbtn_Twin.Checked) { p.roomtype = rbtn_Twin.Value.ToString().Trim(); } else if (rbtn_Family.Checked) { p.roomtype = rbtn_Family.Value.ToString().Trim(); } else if (rbtn_King.Checked) { p.roomtype = rbtn_King.Value.ToString().Trim(); } else if (rbtn_Queen.Checked) { p.roomtype = rbtn_Queen.Value.ToString().Trim(); } client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PostAsJsonAsync <RoomsList>("api/Rooms", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { var a = response.Content.ReadAsStringAsync().Result; CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a); ControlNosUpdate c = new ControlNosUpdate { controldescription = "Room Code", controlnumber = Convert.ToString((Int64.Parse(txtCode_Room.Value.ToString()) + 1)) }; string api = "api/ControlNos/updatecontrol"; post = client.PostAsJsonAsync <ControlNosUpdate>(api, c); post.Wait(); response = post.Result; if (response.IsSuccessStatusCode) { txtCode_Room.Value = Convert.ToString((Int64.Parse(txtCode_Room.Value.ToString()) + 1)); } oCommonEngine.SetAlert(this.Page, "Room Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } else { using (var client = new HttpClient()) { RoomsList p = new RoomsList { roomCode = txtCode_Room.Value.ToString().Trim(), siteCode = ddlSiteCode_Room.Value.ToString().Trim(), description = txteDesc_Room.Value.ToString().Trim(), displayname = txt_RoomNo.Value.ToString().Trim(), equipment = ddlEquipment.Value.ToString().Trim(), isactive = chkRoomActive_Room.Checked }; System.Collections.Generic.List <string> sc = new System.Collections.Generic.List <string>(); foreach (ListItem item in ddlEquipment.Items) { if (item.Selected) { sc.Add(item.Text); } } string csv = String.Join("/", sc.ToArray()); // csv = ddlEquipment.Value.ToString().Trim(); p.equipment = csv; if (rbtn_SingleRoom.Checked) { p.roomtype = rbtn_SingleRoom.Value.ToString().Trim(); } else if (rbtn_Double.Checked) { p.roomtype = rbtn_Double.Value.ToString().Trim(); } else if (rbtn_TripleRoom.Checked) { p.roomtype = rbtn_TripleRoom.Value.ToString().Trim(); } else if (rbtn_QuadRoom.Checked) { p.roomtype = rbtn_QuadRoom.Value.ToString().Trim(); } else if (rbtn_Twin.Checked) { p.roomtype = rbtn_Twin.Value.ToString().Trim(); } else if (rbtn_Family.Checked) { p.roomtype = rbtn_Family.Value.ToString().Trim(); } else if (rbtn_King.Checked) { p.roomtype = rbtn_King.Value.ToString().Trim(); } else if (rbtn_Queen.Checked) { p.roomtype = rbtn_Queen.Value.ToString().Trim(); } client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PutAsJsonAsync <RoomsList>("api/Rooms", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Room Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } DataClear(); Get_Rooms(); } } catch (Exception Ex) { oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } }
protected void Operation_Click(object sender, EventArgs e) { try { if (Validation()) { if (btnSubmit_AddApptStatusMaster.InnerText.Trim() == "Add") { using (var client = new HttpClient()) { ApptBookingStatus p = new ApptBookingStatus { bsCode = txtCode_ApptBookingStatus.Value.ToString().Trim(), bsDesc = txtDesc_ApptBookingStatus.Value.ToString().Trim(), bsColorCode = txtColor.Text.ToString().Trim(), active = chk_ApptBookingStatus.Checked }; client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PostAsJsonAsync <ApptBookingStatus>("api/ApptBookingStatuses", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { var a = response.Content.ReadAsStringAsync().Result; CustomerClassUpdate customerClassesUpdates = JsonConvert.DeserializeObject <CustomerClassUpdate>(a); ControlNosUpdate c = new ControlNosUpdate { controldescription = "APPOINTMENT BOOKING STATUS", sitecode = System.Configuration.ConfigurationManager.AppSettings["SiteCode"].ToString(), controlnumber = Convert.ToString((Int64.Parse(txtCode_ApptBookingStatus.Value.ToString()) + 1)) }; string api = "api/ControlNos/updatecontrol"; post = client.PostAsJsonAsync <ControlNosUpdate>(api, c); post.Wait(); response = post.Result; if (response.IsSuccessStatusCode) { txtCode_ApptBookingStatus.Value = Convert.ToString((Int64.Parse(txtCode_ApptBookingStatus.Value.ToString()) + 1)); } oCommonEngine.SetAlert(this.Page, "Appointment Booking Status Saved Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } else { using (var client = new HttpClient()) { ApptBookingStatusUpdate p = new ApptBookingStatusUpdate { bsCode = txtCode_ApptBookingStatus.Value.ToString().Trim(), bsDesc = txtDesc_ApptBookingStatus.Value.ToString().Trim(), bsColorCode = txtColor.Text.ToString().Trim(), active = chk_ApptBookingStatus.Checked }; client.BaseAddress = new Uri(System.Configuration.ConfigurationManager.AppSettings["uri"]); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json")); var post = client.PostAsJsonAsync <ApptBookingStatusUpdate>("api/ApptBookingStatuses/update?[where][bsCode]=" + txtCode_ApptBookingStatus.Value.ToString() + "", p); post.Wait(); var response = post.Result; if (response.IsSuccessStatusCode) { oCommonEngine.SetAlert(this.Page, "Appointment Booking Status Updated Successfully..!", Utilities.CommonEngine.MessageType.Success, Utilities.CommonEngine.MessageDuration.Short); Response.Redirect("ConfigInterface_ApptBookingStatus.aspx"); } else { oCommonEngine.SetAlert(this.Page, response.StatusCode + "...!", Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } } } DataClear(); } } catch (Exception Ex) { oCommonEngine.SetAlert(this.Page, Ex.Message, Utilities.CommonEngine.MessageType.Error, Utilities.CommonEngine.MessageDuration.Short); } }