public static Premiums MNGR_InsertTSW_Premiums(Premiums value) { Premiums retval = new Premiums(); SqlParameter[] param = new SqlParameter[] { new SqlParameter("@FromLive", value.FromLive), new SqlParameter("@PremInvID", value.PremInvID), new SqlParameter("@TourID", value.TourID), new SqlParameter("@Quantity", value.Quantity), new SqlParameter("@Amount", value.Amount), new SqlParameter("@PremDate", value.PremDate), new SqlParameter("@Note", value.Note), new SqlParameter("@AuditUser", value.AuditUser), new SqlParameter("@PersonnelID", value.Personnel.PersonnelID), new SqlParameter("@AuditDate", value.auditDate), }; //throw new Exception(value.FromLive.ToString() + " " + // value.PremInvID.ToString() + " " + // value.TourID.ToString() + " " + // value.Quantity + " " + // value.Amount + " " + // value.PremDate + " " + // value.Note + " " + // value.AuditUser + " " + // value.Personnel.PersonnelID + " " + // value.auditDate); using (SqlDataReader reader = SqlHelper.ExecuteReader(Helper.ConnectionString, CommandType.StoredProcedure, "ws_usp_AddPremiumToTour", param)) { if (reader.Read()) { retval = Read(reader); } } return retval; }
public static Premiums InsertTSW_Premiums(Premiums value) { Premiums retval = new Premiums(); SqlParameter[] param = new SqlParameter[] { new SqlParameter("@FromLive", value.FromLive), new SqlParameter("@SiteID", value.SiteID), new SqlParameter("@PremInvID", value.PremInvID), new SqlParameter("@CampaignID", value.CampaignID), new SqlParameter("@TourID", value.TourID), new SqlParameter("@Quantity", value.Quantity), new SqlParameter("@Amount", value.Amount), new SqlParameter("@PremDate", value.PremDate), new SqlParameter("@Note", value.Note), new SqlParameter("@AuditUser", value.AuditUser), new SqlParameter("@PersonnelID", value.Personnel.PersonnelID), new SqlParameter("@auditDate", value.auditDate), new SqlParameter("@TourLocationID", value.TourLocationID) }; //I am pointing to the practice database using (SqlDataReader reader = SqlHelper.ExecuteReader(Helper.ConnectionString, CommandType.StoredProcedure, "ws_usp_AssignPremiumToTour", param)) { if (reader.Read()) { retval = Read(reader); } } return retval; }
//Inserts the PremiumsId's in PMS Interface. This code doesn't return any values public static Premiums InsertPMS_Premiums(Premiums value) { Premiums retval = new Premiums(); SqlParameter[] param = new SqlParameter[] { new SqlParameter("@PCIID", value.SIHOTPerson.PCIID), new SqlParameter("@ResNum", value.SIHOTPerson.RNO), new SqlParameter("@HotelNum", value.SIHOTPerson.HN), new SqlParameter("@PremInvId", value.PremInvID), new SqlParameter("@Qty", value.Quantity), new SqlParameter("@PersonnelId", value.Personnel.PersonnelID), new SqlParameter("@TourId", value.TourID), }; using (SqlDataReader reader = SqlHelper.ExecuteReader(Helper.ConnectionString, CommandType.StoredProcedure, "insert_TSWPremiums", param)) { if (reader.Read()) { retval = Read(reader); } } return retval; }
protected void btnBook_Click(object sender, EventArgs e) { //insert in TSW //For the hotel location check the times(time 1, time 2, time 3 it's being used military time) and also if the hotel location has enough presenters //Validate that the prospect doesn't exist by(email, name and telephone number) //DOB, Marital status, //emailid //phone numberid //Names(Guest1, Guest2) //MemberCompany item = new MemberCompany(); //New Code 10/27/10 Check that the fields are not blanc if (ddlTourTime.SelectedValue == string.Empty || ddlTourTime.SelectedValue == string.Empty || ddlTourTime.SelectedValue == string.Empty) { lblValidation.Text = "Values cannot be blank."; return; } lblValidation.Text = ""; TSWProspect itemProspect = new TSWProspect(); TSWProspect itemProspectSrc = new TSWProspect(); TSWProspect itemProspectType = new TSWProspect(); TSWProspect itemProspectStatus = new TSWProspect(); TSWTour itemTour = new TSWTour(); TSWTour itemTourID = new TSWTour(); Personnel itemPersonnel = new Personnel(); Premiums itemPremiums = new Premiums(); PreTourBooking itemPreTourBooking = new PreTourBooking(); itemProspect.FromLive = m_FromLive; itemProspectSrc.FromLive = m_FromLive; itemProspectType.FromLive = m_FromLive; itemProspectStatus.FromLive = m_FromLive; itemTour.FromLive = m_FromLive; itemTourID.FromLive = m_FromLive; //dcitemProspect.HN = SIHOTHotelCode; //Hotel Number from SIHOT itemProspect.HN = SiteId; //Hotel Number from SIHOT itemProspect.Salutation = hdnSalutation.Value; itemProspect.Title = hdnSalutation.Value; itemProspect.CN = lblFName.Text; itemProspect.SN = lblLastName.Text ; itemProspect.Address.Street1 = hdnStreet.Value; itemProspect.Address.City = hdnCity.Value; itemProspect.Address.State = hdnState.Value; itemProspect.Address.Country = hdnCountry.Value; itemProspect.Address.Zip = hdnZipCode.Value; itemProspect.Phone = hdnPhone1.Value; itemProspect.Phone2 = hdnPhone2.Value; itemProspect.Fax = hdnFax.Value; itemProspect.EMAIL = hdnEmail.Value; //throw new Exception(ddlMarital1.SelectedValue); itemProspect.MaritalID = Helper.ToInt32(ddlMarital1.SelectedValue); //throw new Exception(ddlMarital1.SelectedItem.Text); itemProspect.MaritalStatus = ddlMarital1.SelectedItem.Text; itemProspect.OccupationID=Helper.ToInt32(ddlOccupation.SelectedValue); itemProspect.Occupation=ddlOccupation.SelectedItem.Text; itemProspect.IncomeID = Helper.ToInt32(ddlIncome.SelectedValue); itemProspect.DOB=txtDOB.Text; //Get the SourceID thru stored procedure //ws_usp_GetProspectSourcePMSInterface itemProspectSrc= TSWProspectDB.GetProspectSource(itemProspect); itemProspect.ProspectSourceID = itemProspectSrc.ProspectSourceID; itemProspect.ProspectSourceDesc = itemProspectSrc.ProspectSourceDesc; //throw new Exception(itemProspect.SN + itemProspect.ProspectSourceID.ToString()); //Get the ProspectTypeId thru stored procedure //ws_usp_GetProspectType //itemProspect= TSWProspectDB.GetProspectType(itemProspect.FromLive); //itemProspect.ProspectTypeDesc = ""; itemProspectType= TSWProspectDB.GetProspectType(itemProspect); itemProspect.ProspectTypeID = itemProspectType.ProspectTypeID; itemProspect.ProspectTypeDesc = itemProspectType.ProspectTypeDesc; //Get the prospectStausID thru stored procedure //ws_usp_GetProspectStatus itemProspectStatus= TSWProspectDB.GetProspectStatus(itemProspect); itemProspect.ProspectStatusID = itemProspectStatus.ProspectStatusID; itemProspect.ProspectStatusDesc = itemProspectStatus.ProspectStatusDesc; //itemProspect.ProspectStatusID = 1; //itemProspect.ProspectStatusDesc = ""; //Step 1. Validate that the prospect doesn't exist //SearchEmail and SerachPhone APIsol //The fields to validate are Phonenumber, email address, lastname and first name //Fill the options the existing ones and give them the chance to select and option in order to make an update later. //Code for MiniVacs if (lblprospectID.Text != string.Empty && lblTourID.Text!=string.Empty) { //Process MiniVacs requirements on the side //Use ProspectID and TourID already in place for the MiniVacs return; } if (ProspectId == 0 && itemProspect.SN.Trim() != string.Empty && itemProspect.CN.Trim() != string.Empty && (itemProspect.Phone.Trim() != string.Empty || itemProspect.EMAIL.Trim() != string.Empty)) //does't exist the prospect id. I can assign the value of the porspectId from the check dups prospects { //throw new Exception(ProspectId.ToString() + itemProspect.SN + itemProspect.CN + (itemProspect.Phone.Trim() != string.Empty).ToString() + (itemProspect.EMAIL.Trim() != string.Empty).ToString()); int count = 0; TSWProspectList itemProspectList = TSWProspectDB.SearchUniqueProspect(itemProspect, out count); //check the four fields this needs to change NOW if (count > 0 && count != null) { //this needs to change NOW rptDuplicates.DataSource = TSWProspectDB.GetDupsProspects(itemProspect); rptDuplicates.DataBind(); //show the prospectId on top. The assignment of the prospectId happens in the the ItemDatabound of the repeater lblprospectID.Text = Helper.ToString(ProspectId); lblProspectDup.Text = "This prospect already exist in TSW and may have attended to the presentation in the past."; PnlDups.Visible = true; //return; lblConfRNumber.Text = " <font color=red><b>" + ProspectId + " Pre-Existing ProspectId</b></font>"; } else //if doesn't exist in the dups then Insert { ProspectId = TSWProspectDB.InsertTSW_Prospect(itemProspect); lblConfRNumber.Text = " <font color=red><b>" + ProspectId + "</b></font>"; if (ProspectId == 0) { lblConfRNumber.Text = "Error Creating Prospect"; return; } } } else if (lblprospectID.Text == string.Empty) { //***************************************** //***************************************** //***************************************** //I still need to check the Search FName & LastName. Insert happens, this means that the prospect doesn't exit //if (SearchEmail() != "true" && SearchPhone() != "true") //{ //throw new Exception(itemProspect.ProspectTypeID + " " + itemProspect.ProspectTypeDesc + " " + itemProspect.ProspectStatusID + " " + itemProspect.ProspectSourceID); ProspectId = TSWProspectDB.InsertTSW_Prospect(itemProspect); //call the TUNA here TRANSUNION //call the TUNA here TRANSUNION //if (m_FromLive == 1) //{ // ParseStringFWD_TOne_prod(); //SaveResults_TUNA_prod(); //} //else //{ //ParseStringFWD_TOne_test(); // SaveResults_TUNA_test(); //} //call the TUNA here TRANSUNION //call the TUNA here TRANSUNION lblConfRNumber.Text = " <font color=red><b>" + ProspectId + "</b></font>"; if (ProspectId == 0) { lblConfRNumber.Text = "Error Creating Prospect"; return; } } //the one that says about the prospect phNewProspect.Visible = true; //} //else //{ ////Step 2.or make an update WebAPI_UpdateTourProspect // lblConfRNumber.Text = " <font color=red><b>" + Helper.ToString(TSWProspectDB.UpdateTSW_Prospect(itemProspect)) + "</b></font>"; //} //***************************************** //***************************************** //***************************************** //Step 3 Create the Tour webapibooked tour itemTour.FromLive = m_FromLive; itemTour.SiteID=SiteId; itemTour.ProspectId = ProspectId; itemTour.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue); //Get the tourTypeId New Member addition //TourTypeID:7866 TourType: 'Members' //case statement //throw new Exception(hdnDisplaySegment.Value); if (hdnDisplaySegment.Value.ToLower().Contains("members") == true) { itemTour.TourTypeDesc = "Members"; } else { itemTour.TourTypeDesc = "In House"; } //itemTour.TourTypeDesc = "In House"; itemTourID = TSWTourDB.GetTourTypeID(itemTour); itemTour.TourTypeID = itemTourID.TourTypeID; //"In House=190" VALUE itemTour.TourLocationID = Helper.ToInt32(ddlTourLocation.SelectedValue); itemTour.TourDate=Helper.ToDateTime(txtTourDate.Text).Value; //itemTour.PreAssignedTo = ddlPromotorName.SelectedValue; itemTour.waveID=Helper.ToInt32(ddlTourTime.SelectedValue); //Response.Write(itemTour.SiteID + " " + itemTour.ProspectId + " " + itemTour.CampaignID + " " + itemTourID.TourTypeID + " " + itemTour.TourLocationID + " " + itemTour.TourDate + " " + itemTour.waveID); //Inserts the Tour in table t_tour. Return string "success or failure" and the tourid TSWTourList itemTourReturn = TSWTourDB.InsertTSW_Tour(itemTour); foreach (TSWTour item in itemTourReturn) { lblErrors.Text = ""; if (item.ReturnValue !=0) { lblErrorsTour.Visible = true; lblErrorsTour.Text += "Error creating Tour: " + item.ReturnValue + ", " + item.ReturnString; lblErrors.Text += "Error creating Tour: " + item.ReturnValue + ", " + item.ReturnString; PnlError.Visible = true; } else { TourId = item.TourID; lblErrors.Text += "Tour Created Succesfully:" + TourId; PnlError.Visible = true; } } //lblConfRNumber.Text += "TourId AfterCreate: "+ Helper.ToString(TSWTourDB.InsertTSW_Tour(itemTour)); //***************************************** //***************************************** //***************************************** //This number is generated from the previous line itemPersonnel.FromLive = m_FromLive; itemPersonnel.TourID = TourId; itemPersonnel.PersonnelID = Helper.ToInt32(ddlPromotorName.SelectedValue); itemPersonnel.TitleID = varTitleId;//46 Per Angel Torres it's ok to leave it like this //itemPersonnel.TitleID = Helper.ToInt32(TitleID); //step 4. Assign Personnel //Response.Write(itemPersonnel.TourID+ 1+ 1+1); Personnel itemRetunPersonnel= PersonnelDB.InsertTSW_Personnel(itemPersonnel); if (itemRetunPersonnel.ReturnValue <= 10) { //lblErrors.Text += "Error Creating Personnel" + itemRetunPersonnel.ReturnValue + itemRetunPersonnel.ReturnString; PnlError.Visible = true; } else { //lblErrors.Text += "Personnel Created Succesfully: " + itemRetunPersonnel.ReturnValue; //varPersonnelIdAssigned= itemRetunPersonnel.ReturnValue; PnlError.Visible = true; } //***************************************** //***************************************** //***************************************** //Step 5. Assign Premium Tours //loop for all the grid and premiums. I recommend to create an array and then save the array int varQty=0; foreach (RepeaterItem item in rptrPremiums.Items) { //varQty += Helper.ToInt32((TextBox)item.FindControl("txtPremQty")); varQty = Helper.ToInt32((string)((TextBox)item.FindControl("txtPremQty")).Text); //throw new Exception(varQty.ToString()); if (varQty>0) { itemPremiums.FromLive = m_FromLive; itemPremiums.SiteID = SiteId; itemPremiums.SIHOTPerson.HN = Helper.ToInt32(hdnHNDirectFromSIHOT.Value); itemPremiums.SIHOTPerson.PCIID = parPCIID; itemPremiums.SIHOTPerson.RNO = paridRNO; itemPremiums.Personnel.PersonnelID = Helper.ToInt32(ddlPromotorName.SelectedValue); ; itemPremiums.PremInvID =Helper.ToInt32((string)((Literal)item.FindControl("litPremID")).Text); itemPremiums.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue); itemPremiums.TourID = TourId; itemPremiums.Quantity = Helper.ToInt32((string) ((TextBox) item.FindControl("txtPremQty")).Text); //Save the amount of the voucher //if (itemPremiums.Catalogs.PremInvTypeID==6) //{ //if (Helper.ToDecimal((string)((TextBox)item.FindControl("txtPremAmt")).Text)!=0) itemPremiums.Amount = Helper.ToDecimal((string)((TextBox)item.FindControl("txtPremAmt")).Text); //} itemPremiums.PremDate = Helper.ToDateTime(txtTourDate.Text); //itemPremiums.Note = valuefromdatagridnotes; itemPremiums.AuditUser = varSystemUser; itemPremiums.auditDate = Helper.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")); itemPremiums.TourLocationID =Helper.ToInt32(ddlTourLocation.SelectedValue); Premiums itemRetunPremiums = PremiumsDB.InsertTSW_Premiums(itemPremiums); if (itemRetunPremiums.ReturnString != "Success") { //lblErrors.Text += "Error Creating the Premium:" + // itemRetunPremiums.ReturnString + itemRetunPremiums.ReturnValue; PnlError.Visible = true; } //else //{ //lblErrors.Text += "Premium Created Succesfully: " + itemRetunPremiums.ReturnValue; //PnlError.Visible = true; //Insert all the PremId generated from TSW in PMS Interface //Verify that the inherid values are being taken witht the current values from the screen //To be tested3/4/2010 //PremiumsDB.InsertPMS_Premiums(itemPremiums); //} } } //Step6. Save the Status, the prospectId, and tourid and disable the Premiums Grid if ((string)Session["AccessLevel"] != "Manager") { DisableRepeater(); } itemPreTourBooking.ReservationNumber = Helper.ToInt32(lblReservation.Text); itemPreTourBooking.Status = "Booked"; lblStatus.Text = "Booked"; hdnStatus.Value = "Booked"; itemPreTourBooking.FromLive = m_FromLive; if (TourId != 0) itemPreTourBooking.TourID = TourId; else itemPreTourBooking.TourID = 1111; itemPreTourBooking.ProspectID = ProspectId; itemPreTourBooking.PCIID = parPCIID; itemPreTourBooking.HN = Helper.ToInt32(hdnHNDirectFromSIHOT.Value); itemPreTourBooking.SubReservationNumber = Helper.ToInt32(hdnRSNO.Value); PreTourBookingDB.Update_PreBooked(itemPreTourBooking); btnBook.Visible = false; btnPremiums.Visible = false; phNewProspect.Visible = false; lblprospectID.Text=Helper.ToString(ProspectId); lblTourID.Text=Helper.ToString(TourId); DisableAll(); lblErrors.Text = "<font color='blue'>To make changes use TSW.</font>"; PnlError.Visible = true; //Save Notes in TSW Interface for the Booked Status if (TxtNotesBooked.Text != "") { SaveNotesTSW(ddlCommentType, TxtNotesBooked, false); } SaveAutomaticNotesPMS("Prospect has been Booked"); ShowComments(); //Shows THE PREMIUMS HISTORY LoadPremiums_TSW(); }
protected void btnSaveMgrPremiums_Click(object sender, EventArgs e) { Premiums itemPremiums = new Premiums(); //Save the info for the premiums //loop for all the grid and premiums. I recommend to create an array and then save the array int varQty=0; foreach (RepeaterItem item in rptrPremiums.Items) { varQty = Helper.ToInt32((string) ((TextBox) item.FindControl("txtPremQty")).Text); if (varQty > 0) { itemPremiums.FromLive = m_FromLive; itemPremiums.SiteID = SiteId; itemPremiums.SIHOTPerson.HN = Helper.ToInt32(hdnHNDirectFromSIHOT.Value); itemPremiums.SIHOTPerson.PCIID = parPCIID; itemPremiums.SIHOTPerson.RNO = paridRNO; itemPremiums.PremInvID = Helper.ToInt32((string) ((Literal) item.FindControl("litPremID")).Text); itemPremiums.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue); itemPremiums.TourID = Helper.ToInt32(lblTourID.Text); itemPremiums.Quantity = Helper.ToInt32((string) ((TextBox) item.FindControl("txtPremQty")).Text); itemPremiums.Amount = Helper.ToDecimal((string) ((TextBox) item.FindControl("txtPremAmt")).Text); itemPremiums.Personnel.PersonnelID = Helper.ToInt32((string) ((DropDownList) item.FindControl("ddlPromisedBy")).SelectedValue); itemPremiums.PremDate = Helper.ToDateTime(txtTourDate.Text); itemPremiums.AuditUser = varSystemUser; itemPremiums.auditDate = Helper.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")); itemPremiums.TourLocationID = Helper.ToInt32(ddlTourLocation.SelectedValue); Premiums itemRetunPremiums = PremiumsDB.MNGR_InsertTSW_Premiums(itemPremiums); if (itemRetunPremiums.ReturnString != "Success") { PnlError.Visible = true; //return; } } pnlSavePremConf.Visible = true; pnlPremiumsMain.Visible = false; lblSavePremConf.Text = "Premium(s) Saved succesfully."; } ////Shows THE PREMIUMS HISTORY //LoadPremiums_TSW(); ////Save notes about the MANAGER that saved the premiums //SaveAutomaticNotesPMS("EXTRA Premiums saved by " + varSystemUser); //ShowComments(); }
void datagridIteration() { int varQty = 0; string varNumQty, varPremId = ""; lblNumberElementsDataGrid.Text = ""; Premiums itemPremiums = new Premiums(); foreach (RepeaterItem item in rptrPremiums.Items) { varQty = Helper.ToInt32((string)((TextBox)item.FindControl("txtPremQty")).Text); //throw new Exception(varQty.ToString()); if (varQty > 0) { itemPremiums.SiteID = SiteId; itemPremiums.PremInvID = Helper.ToInt32((string)((Literal)item.FindControl("litPremID")).Text); itemPremiums.CampaignID = Helper.ToInt32(ddlCampaign.SelectedValue); //itemPremiums.TourID = TourId; itemPremiums.TourID = 155333; //remove itemPremiums.Quantity = Helper.ToInt32((string)((TextBox)item.FindControl("txtPremQty")).Text); itemPremiums.PremDate = Helper.ToDateTime(txtTourDate.Text); //itemPremiums.Note = valuefromdatagridnotes; itemPremiums.AuditUser = varSystemUser; itemPremiums.auditDate = Helper.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy")); itemPremiums.TourLocationID = Helper.ToInt32(ddlTourLocation.SelectedValue); Premiums itemRetunPremiums = PremiumsDB.InsertTSW_Premiums(itemPremiums); if (itemRetunPremiums.ReturnString != "0-Success") { lblErrors.Text += "Error Creating the Premium:" + itemRetunPremiums.ReturnString + itemRetunPremiums.ReturnString; PnlError.Visible = true; } else { lblErrors.Text += "Premium Created Succesfully: " + itemRetunPremiums.ReturnString; PnlError.Visible = true; } lblNumberElementsDataGrid.Text += varQty + ", "; } } }
public static Premiums Read(SqlDataReader reader) { Premiums retval = new Premiums(); for (int i = 0; i < reader.FieldCount; i++) { switch (reader.GetName(i)) { case "TourID": retval.CampaignID = Helper.ToInt32(reader[i]); break; case "ResultString": retval.ReturnString = Helper.ToString(reader[i]); break; case "PremPromisedID": retval.ReturnValue = Helper.ToInt32(reader[i]); break; case "PremInvTypeID": retval.Catalogs.PremInvTypeID = Helper.ToInt32(reader[i]); break; case "Quantity": retval.Quantity = Helper.ToInt32(reader[i]); break; case "Amount": retval.Amount = Helper.ToDecimal(reader[i]); break; } } return retval; }