コード例 #1
0
    public long SaveProjectNote(App.CustomModels.CustomProjectNote customNote)
    {
        OMMDataContext context = new OMMDataContext();
        ProjectNote    note    = null;

        if (customNote.ID > 0)
        {
            note = context.ProjectNotes.SingleOrDefault(P => P.ID == customNote.ID);
        }
        else
        {
            note = new ProjectNote();
            context.ProjectNotes.InsertOnSubmit(note);
        }
        note.ProjectID   = customNote.ProjectID;
        note.Details     = customNote.Details;
        note.CreatedBy   = SessionCache.CurrentUser.ID;
        note.CreatedDate = DateTime.Now;
        context.SubmitChanges();
        return(note.ID);
    }
コード例 #2
0
    /// <summary>
    /// Saves Enquiry Line Items
    /// </summary>
    /// <param name="customEnquiry"></param>
    /// <param name="enquiry"></param>
    /// <param name="context"></param>
    private static void SaveEnquiryLineItems(CustomEnquiry customEnquiry, Enquiry enquiry, OMMDataContext context)
    {
        EnquiryLine enquiryLine = new EnquiryLine();

        if (enquiry.EnquiryLines.Count > 0)
        {
            enquiryLine = enquiry.EnquiryLines[0];
        }
        else
        {
            enquiry.EnquiryLines.Add(enquiryLine);
            context.EnquiryLines.InsertOnSubmit(enquiryLine);
        }

        enquiryLine.Details         = customEnquiry.Details;
        enquiryLine.EnquiryID       = enquiry.ID;
        enquiryLine.ChangedByUserID = SessionCache.CurrentUser.ID;
        enquiryLine.ChangedOn       = DateTime.Now;

        context.SubmitChanges();
    }
コード例 #3
0
    protected void SaveBankDetails()
    {
        OMMDataContext context = new OMMDataContext();
        BankDetail     entity  = null;

        if (_IsEditMode)
        {
            entity = context.BankDetails.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID);
        }
        else
        {
            entity           = new BankDetail();
            entity.ContactID = _ContactID;
            context.BankDetails.InsertOnSubmit(entity);
        }

        //ddlContactID.SelectedValue.ToInt();
        entity.BankName      = tbxBankName.Text;
        entity.BranchName    = tbxBranchName.Text;
        entity.BranchAddress = tbxBranchAddress.Text;
        entity.SortCode      = tbxSortCode.Text;
        entity.AccountNumber = tbxAccNumber.Text;
        entity.AccountName   = tbxAccName.Text;
        entity.BicCode       = tbxBicCode.Text;
        entity.AbaCode       = tbxAbaCode.Text;

        entity.ChangedByUserId = SessionCache.CurrentUser.ID;
        entity.ChangedOn       = DateTime.Now;
        //entity = entity.ChangedByUsername = SessionCache.CurrentUser.UserName;

        context.SubmitChanges();
        String url = String.Format("{0}?{1}={2}&{3}=True"
                                   , Request.Url.AbsolutePath
                                   , AppConstants.QueryString.CONTACT_ID
                                   , _ContactID
                                   , AppConstants.QueryString.SUCCESS_MSG);

        Response.Redirect(url);
    }
コード例 #4
0
    public static bool DeleteEnquiryAttachment(int fileId, String fileName)
    {
        OMMDataContext context = new OMMDataContext();
        EnquiryFile    file    = context.EnquiryFiles.SingleOrDefault(F => F.ID == fileId);

        if (file == null)
        {
            ///Deleting Attachement in Enquiry Add Mode
            if (!fileName.IsNullOrEmpty())
            {
                if (fileName.StartsWith(".."))
                {
                    fileName = fileName.Replace("..", String.Empty);
                }
                fileName = HttpContext.Current.Server.MapPath(fileName);
                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }

                fileName = Path.GetFileName(fileName);
                RemoveAttachmentFromSession(fileName);
            }
        }
        else
        {
            String filePath = Path.Combine(HttpContext.Current.Server.MapPath(AppConstants.ENQUIRY_ATTACHMENTS), String.Format(@"{0}\{1}", file.EnquiryID, file.FileName));
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
            context.EnquiryFiles.DeleteOnSubmit(file);
            context.SubmitChanges();
            RemoveAttachmentFromSession(Path.GetFileName(filePath));
            return(true);
        }
        return(false);
    }
コード例 #5
0
    protected void SaveContactsPassport()
    {
        OMMDataContext context = new OMMDataContext();
        Passport       entity  = null;

        if (_IsEditMode)
        {
            entity = context.Passports.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID);
        }
        else
        {
            entity           = new Passport();
            entity.ContactID = _ContactID;
            context.Passports.InsertOnSubmit(entity);
        }

        //ddlContactID.SelectedValue.ToInt();
        entity.Number      = tbxNumber.Text;
        entity.WhereIssued = tbxWhereIssued.Text;
        if (tbxExpiryDate.Text.IsNullOrEmpty())
        {
            entity.ExpiryDate = null;
        }
        else
        {
            entity.ExpiryDate = tbxExpiryDate.Text.ToDateTime(ConfigReader.CSharpCalendarDateFormat); //Convert.ToDateTime(tbxExpiryDate.Text.Trim());
        }
        entity.Nationality = tbxNationality.Text;


        entity.ChangedByUserID = SessionCache.CurrentUser.ID;
        entity.ChangedOn       = DateTime.Now;
        //entity = entity.ChangedByUsername = SessionCache.CurrentUser.UserName;

        context.SubmitChanges();
        RedirectToShowSuccessMessage();
    }
コード例 #6
0
    protected void SaveNextOfKin()
    {
        OMMDataContext context = new OMMDataContext();
        NextOfKin      entity  = null;

        if (_IsEditMode)
        {
            entity = context.NextOfKins.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID);
        }
        else
        {
            entity           = new NextOfKin();
            entity.ContactID = _ContactID;
            context.NextOfKins.InsertOnSubmit(entity);
        }

        entity.Name         = tbxName.Text;
        entity.Relationship = tbxRelationShip.Text;
        entity.Address      = tbxAddress.Text;
        entity.Postcode     = tbxPostCode.Text;

        if (!ddlCountry.SelectedValue.IsNullOrEmpty())
        {
            entity.CountryID = ddlCountry.SelectedValue.ToInt(); //Convert.ToInt32(ddlCountry.SelectedValue);
        }

        entity.HomeNumber   = tbxHomeNumber.Text;
        entity.WorkNumber   = tbxWorkNumber.Text;
        entity.MobileNumber = tbxMobile.Text;


        entity.ChangedByUserID = SessionCache.CurrentUser.ID;
        entity.ChangedOn       = DateTime.Now;

        context.SubmitChanges();
        RedirectToShowSuccessMessage();
    }
コード例 #7
0
    protected void SaveSkills()
    {
        OMMDataContext context = new OMMDataContext();

        if (context.Contacts.FirstOrDefault(P => P.ID == _ContactID) != null)
        {
            ////pnlEmpHistory.Visible = true;
            //ShowNotFoundMessage();
            Contact entity = context.Contacts.FirstOrDefault(P => P.ID == _ContactID);



            if (txtDateOfLastMeeting.Text.IsNullOrEmpty())
            {
                entity.DateOfLastMeeting = null;
            }
            else
            {
                entity.DateOfLastMeeting =
                    txtDateOfLastMeeting.Text.ToDateTime(ConfigReader.CSharpCalendarDateFormat);
            };

            if (txtPreferredDayRate.Text.IsNullOrEmpty())
            {
                entity.PreferredDayRate = null;
            }
            else
            {
                entity.PreferredDayRate =
                    Convert.ToInt32(Convert.ToDouble(txtPreferredDayRate.Text));
            }

            entity.PPE_Sizes = ddlPPE_Size.SelectedItem.Text;

            entity.Coverall = (txtcoverall.Text.IsNullOrEmpty() ? null : txtcoverall.Text);
            entity.Boots    = Convert.ToInt32(ddlbootsize.SelectedItem.Text);

            entity.NoSMSorEmail = chkNoSMSorEmail.Checked ? true : false;
            entity.Inactive     = chkInactive.Checked ? true : false;

            entity.CopmpanyName   = (txtcompanyname.Text.IsNullOrEmpty() ? null : txtcompanyname.Text);
            entity.CompanyReg     = (txtcompanyreg.Text.IsNullOrEmpty() ? null : txtcompanyreg.Text);
            entity.CompanyVat     = (txtcompanyvat.Text.IsNullOrEmpty() ? null : txtcompanyvat.Text);
            entity.CompanyAddress = (txtcompanyadr.Text.IsNullOrEmpty() ? null : txtcompanyadr.Text);


            entity.employment_status = ddlemploymentstatus.SelectedItem.Text;
            entity.Insurance         = ddlinsurance.SelectedItem.Text;


            context.SubmitChanges();



            String url = String.Format("{0}?{1}={2}&{3}=True"
                                       , Request.Url.AbsolutePath
                                       , AppConstants.QueryString.CONTACT_ID, _ContactID
                                       , AppConstants.QueryString.SUCCESS_MSG);
            Response.Redirect(url);
        }
    }
コード例 #8
0
    protected void SaveEmploymentHistory()
    {
        OMMDataContext    context = new OMMDataContext();
        EmploymentHistory entity  = null;

        if (_IsEditMode)
        {
            entity = context.EmploymentHistories.FirstOrDefault(P => P.ID == _ID && P.ContactID == _ContactID); //dao.GetByID(_ID);
        }
        else
        {
            entity           = new EmploymentHistory();
            entity.ContactID = _ContactID;
            context.EmploymentHistories.InsertOnSubmit(entity);
        }

        //entity.ContactID = ddlContactID.SelectedValue.ToInt();
        if (txtStartDate.Text.IsNullOrEmpty())
        {
            entity.StartDate = null;
        }
        else
        {
            entity.StartDate = txtStartDate.Text.ToDateTime(ConfigReader.CSharpCalendarDateFormat);
        };
        if (txtEndDate.Text.IsNullOrEmpty())
        {
            entity.EndDate = null;
        }
        else
        {
            entity.EndDate = txtEndDate.Text.ToDateTime(ConfigReader.CSharpCalendarDateFormat);
        };

        if (ddlProjectID.SelectedValue.ToInt() == 0)
        {
            entity.ProjectID = null;
        }
        else
        {
            entity.ProjectID = ddlProjectID.SelectedValue.ToInt();
        }
        if (ddlRoleID.SelectedValue.ToInt() == 0)
        {
            entity.RoleID = null;
        }
        else
        {
            entity.RoleID = ddlRoleID.SelectedValue.ToInt();
        }

        if (ddlCurrencyCode.SelectedValue.ToInt() == 0)
        {
            entity.CurrencyID = null;
        }
        else
        {
            entity.CurrencyID = ddlCurrencyCode.SelectedValue.ToInt();
        }

        if (txtDayRate.Text.IsNullOrEmpty())
        {
            entity.DayRate = null;
        }
        else
        {
            entity.DayRate = txtDayRate.Text.ToDecimal();
        }
        entity.Notes           = txtNotes.Text;
        entity.ChangedByUserID = SessionCache.CurrentUser.ID;
        entity.ChangedOn       = DateTime.Now;
        //entity.Version = txtVersion.Text;
        //if (txtContractdays.Text.Trim() != "")
        //    entity.Contract_days = Convert.ToInt32(txtContractdays.Text);

        if (radFive.Checked)
        {
            entity.Contract_days = 5;
        }
        else if (radSeven.Checked)
        {
            entity.Contract_days = 7;
        }
        else
        {
            entity.Contract_days = null;
        }


        if (txtTravelRate.Text.Trim() != "")
        {
            entity.TravelRate = Convert.ToInt32(txtTravelRate.Text);
        }

        entity.Office_Onsh_Rate_type  = ddlRateType.SelectedValue;
        entity.Hour_Standby_Rate_type = ddlHourStandby.SelectedValue;


        if (txtTravelCost.Text.Trim() != "")
        {
            entity.TravelCost = Convert.ToInt32(txtTravelCost.Text);
        }

        if (txtOfficeOnshoreRate.Text.Trim() != "")
        {
            entity.OfficeOnshoreRate = Convert.ToDecimal(txtOfficeOnshoreRate.Text);
        }

        //entity.Hour_Standby_Rate_type = txtHourStandbyRatetype.Text;

        if (txtOfficeOnshoreRate.Text.Trim() != "")
        {
            entity.HourStandbyRate = Convert.ToDecimal(txtHourStandbyRate.Text);
        }
        entity.ProjectCode_other = txtProjectCodeother.Text;
        context.SubmitChanges();
        String url = String.Format("{0}?{1}={2}&{3}=True"
                                   , Request.Url.AbsolutePath
                                   , AppConstants.QueryString.CONTACT_ID, _ContactID
                                   , AppConstants.QueryString.SUCCESS_MSG);

        Response.Redirect(url);
    }
コード例 #9
0
ファイル: QuotationChange.aspx.cs プロジェクト: hazdik/bdomm
    private static void ProcessAndSaveQuotation(Quotation quotation, IList <App.CustomModels.CustomQuotationPricingLine> pricingLineItems, OMMDataContext dataContext)
    {
        Enquiry enquiry = dataContext.Enquiries.SingleOrDefault(E => E.ID == quotation.EnquiryID);

        ///Enquiry Section
        if (quotation.ID == 0)
        {
            enquiry.StatusID = App.CustomModels.EnquiryStatus.Quoted;
            dataContext.Quotations.InsertOnSubmit(quotation);
        }
        else if (quotation.StatusID == App.CustomModels.QuotationStatus.Unsuccessful)// 3)
        {
            enquiry.StatusID = App.CustomModels.EnquiryStatus.Closed;
        }
        else if (quotation.StatusID == App.CustomModels.QuotationStatus.Successful)
        {
            enquiry.StatusID = App.CustomModels.EnquiryStatus.Closed;
        }
        else if (quotation.StatusID == App.CustomModels.QuotationStatus.ReQquoteRequested)
        {
            //TODO: Add Copy Function. Will be found in the Win App at
            ///QuotationDataset.cs. Line 591
        }
        ///QuotationPricingLine Section
        if (pricingLineItems != null && pricingLineItems.Count > 0)
        {
            ///If in Edit Mode Delete existing data first then insert new ones
            //TODO: We will need to change it to work in edit mode.
            //if (quotation.ID > 0)
            //    quotation.QuotationPricingLines.Clear();

            foreach (App.CustomModels.CustomQuotationPricingLine pricing in pricingLineItems)
            {
                if (pricing.ID > 0)
                {
                    ///For Edit
                    QuotationPricingLine linqPricing = dataContext.QuotationPricingLines.SingleOrDefault(P => P.ID == pricing.ID);
                    ///Map Objects
                    PreparePricingLineItem(pricing, quotation.ID, linqPricing);
                }
                else
                {
                    quotation.QuotationPricingLines.Add(PreparePricingLineItem(pricing, quotation.ID, new QuotationPricingLine()));
                }
            }
        }

        ///Project Section
        ///TODO: Could not found the code that how it is bind to the UI while creating quotation
        //Project project = new Project();
        //if (project.ID == 0)
        //{
        //    project.CreatedByUserID = SessionCache.CurrentUser.ID;
        //    project.CreatedByUsername = SessionCache.CurrentUser.UserName;
        //    project.CreatedOn = DateTime.Now;
        //    project.StatusID = App.CustomModels.ProjectStatus.InProgress;
        //    project.Number = dataContext.GenerateNewProjectNumber();
        //}
        //project.ChangedByUserID = SessionCache.CurrentUser.ID;
        //project.ChangedByUsername = SessionCache.CurrentUser.UserName;
        //project.ChangedOn = DateTime.Now;
        //project.StartDate = DateTime.Now;

        //project.Description = quotation.ScopeOfWork;
        //project.Name = enquiry.EnguirySubject;
        //quotation.Projects.Add(project);

        //enquiry.Quotations.Add(quotation);

        dataContext.SubmitChanges();
    }
コード例 #10
0
    protected void btnSaveNextKin_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            //Save information in the database
            OMMDataContext context   = new OMMDataContext();
            int            contactID = WebUtil.GetQueryStringInInt("ID");

            if (btnSaveNextKin.Text == "Save")
            {
                NextOfKin NextKin = new NextOfKin();

                NextKin.ContactID    = contactID;
                NextKin.Name         = (tbxName.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxName.Text.ToString().Trim();
                NextKin.Relationship = (tbxRelationShip.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxRelationShip.Text.ToString().Trim();
                NextKin.Address      = (tbxAddress.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxAddress.Text.ToString().Trim();
                NextKin.Postcode     = (tbxPostCode.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxPostCode.Text.ToString().Trim();
                if (Convert.ToInt32(ddlCountry.SelectedValue) > 0)
                {
                    NextKin.CountryID = Convert.ToInt32(ddlCountry.SelectedValue);
                }
                NextKin.HomeNumber   = (tbxHomeNumber.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxHomeNumber.Text.ToString().Trim();
                NextKin.WorkNumber   = (tbxWorkNumber.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxWorkNumber.Text.ToString().Trim();
                NextKin.MobileNumber = (tbxMobile.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxMobile.Text.ToString().Trim();

                NextKin.ChangedByUserID = SessionCache.CurrentUser.ID;
                NextKin.ChangedOn       = System.DateTime.Today;

                context.NextOfKins.InsertOnSubmit(NextKin);
                context.SubmitChanges();

                clearControl();
            }
            else
            {
                var NextKin = context.NextOfKins.FirstOrDefault(P => P.ID == Convert.ToInt32(tbxNextOfKinID.Text));


                if (NextKin == null || contactID == 0)
                {
                }
                else
                {
                    NextKin.ContactID    = contactID;
                    NextKin.Name         = (tbxName.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxName.Text.ToString().Trim();
                    NextKin.Relationship = (tbxRelationShip.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxRelationShip.Text.ToString().Trim();
                    NextKin.Address      = (tbxAddress.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxAddress.Text.ToString().Trim();
                    NextKin.Postcode     = (tbxPostCode.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxPostCode.Text.ToString().Trim();
                    if (Convert.ToInt32(ddlCountry.SelectedValue) > 0)
                    {
                        NextKin.CountryID = Convert.ToInt32(ddlCountry.SelectedValue);
                    }
                    NextKin.HomeNumber   = (tbxHomeNumber.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxHomeNumber.Text.ToString().Trim();
                    NextKin.WorkNumber   = (tbxWorkNumber.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxWorkNumber.Text.ToString().Trim();
                    NextKin.MobileNumber = (tbxMobile.Text.ToString().Trim().IsNullOrEmpty()) ? "" : tbxMobile.Text.ToString().Trim();

                    NextKin.ChangedByUserID = SessionCache.CurrentUser.ID;
                    NextKin.ChangedOn       = System.DateTime.Today;

                    context.SubmitChanges();
                }
            }


            loadNextOfKinDetails(contactID);
        }
    }
コード例 #11
0
    public static int SavePersonnel(App.CustomModels.Personnel personnel,
                                    List <App.CustomModels.PersonnelTelephone> telephones,
                                    List <App.CustomModels.ConNote> ConNotes,
                                    List <App.CustomModels.PersonnelEmail> emails,
                                    List <App.CustomModels.PersonnelRole> roles)
    {
        OMMDataContext context = new OMMDataContext();
        Contact        contact = populateContact(personnel, context);

        ///Bind Telephones
        if (telephones != null && telephones.Count > 0)
        {
            foreach (App.CustomModels.PersonnelTelephone telephone in telephones)
            {
                TelephoneNumber phone = null;
                if (telephone.ID > 0)
                {
                    phone = context.TelephoneNumbers.SingleOrDefault(P => P.ID == telephone.ID);
                }
                else
                {
                    phone = new TelephoneNumber();
                    contact.TelephoneNumbers.Add(phone);
                }
                phone.Number          = telephone.Number;
                phone.TypeID          = telephone.TypeID;
                phone.ChangedByUserID = SessionCache.CurrentUser.ID;
                phone.ChangedOn       = DateTime.Now;
            }
        }

        ///Bind Notes
        if (ConNotes != null && ConNotes.Count > 0)
        {
            foreach (App.CustomModels.ConNote conNote in ConNotes)
            {
                ContactsNote note = null;
                if (conNote.ID > 0)
                {
                    note = context.ContactsNotes.SingleOrDefault(P => P.ID == conNote.ID);
                }
                else
                {
                    note = new ContactsNote();
                    contact.ContactsNotes.Add(note);
                }
                note.Notes = conNote.Notes;
                if (conNote.CommsTypeID != null)
                {
                    note.ContactCommsTypeID = Convert.ToInt32(conNote.CommsTypeID);
                }

                note.ChangedByUserID = SessionCache.CurrentUser.ID;
                note.ChangedOn       = DateTime.Now;
            }
        }

        ///Bind Eamils
        if (emails != null && emails.Count > 0)
        {
            foreach (App.CustomModels.PersonnelEmail email in emails)
            {
                EmailAddress contactEmail = null;
                if (email.ID > 0)
                {
                    contactEmail = context.EmailAddresses.SingleOrDefault(P => P.ID == email.ID);
                }
                else
                {
                    contactEmail = new EmailAddress();
                    contact.EmailAddresses.Add(contactEmail);
                }
                contactEmail.Address         = email.Email;
                contactEmail.ChangedByUserID = SessionCache.CurrentUser.ID;
                contactEmail.ChangedOn       = DateTime.Now;
            }
        }
        ///Roles

        context.SubmitChanges();
        return(contact.ID);
    }
コード例 #12
0
ファイル: Default.aspx.cs プロジェクト: hazdik/bdomm
    private bool SendMessage(Message message, IList <Message_Recipient> receivers)
    {
        Message smsr     = null;
        String  userName = ConfigReader.TextAnywhereClientID;
        String  password = ConfigReader.TextAnywhereClientPassword;

        String[] sendSMSReplyArray = null;
        String   sendSmsReply      = string.Empty;

        String[] returnCodePair = null;

        System.Text.StringBuilder destinationNumbers = destinationNumbers = new System.Text.StringBuilder(10);

        // Check recipients list not empty
        if (receivers.Count <= 0)
        {
            return(false);
        }

        //// Request a new SMS_ID from the database
        //if (null == (smsr = GetNewSMSRow()))
        //{
        //    return false;
        //}

        // Check SMS Service is running
        if (!IsSmsServiceRunning())
        {
            return(false);
        }

        // Build destination number list
        foreach (Message_Recipient mrr in receivers)
        {
            if (destinationNumbers.Length > 0)
            {
                destinationNumbers.Append(COMMA_SEPARATOR);
            }

            destinationNumbers.Append(mrr.Destination);
        }

        //SmsService.TextAnywhere_SMS ta_sms = new SmsService.TextAnywhere_SMS();
        //sendSmsReply = ta_sms.SendSMSEx(
        //            username,
        //            password,
        //            smsr.Client_Ref,
        //            BILLING_REF,
        //            (int)CONNECTION_TYPES.TEST,
        //            ORIGINATOR,
        //            (int)ORIGINATOR_TYPES.NAME,
        //            destinationNumbers.ToString(),
        //            message.Text,
        //            0,
        //            (int)REPLY_TYPES.NONE, "");

        // Extract return codes
        sendSMSReplyArray = sendSmsReply.Split(COMMA_SEPARATOR);

        if (sendSMSReplyArray.Length != receivers.Count)
        {
            m_lastError = "Unable to send SMS message.  SMS Service did not return the expected data.";
            return(false);
        }

        // Iterate the return codes
        foreach (string returnCode in sendSMSReplyArray)
        {
            returnCodePair = returnCode.Split(COLON_SEPARATOR);

            // Look up the phone number in the recipients list
            foreach (Message_Recipient receiver in receivers)
            {
                // Phone number match
                if (receiver.Destination == returnCodePair[0])
                {
                    // Store return code, sms id, and update message status accordingly

                    // Update row
                    //mrr.BeginEdit();
                    receiver.SMS_ID        = smsr.ID;
                    receiver.SMS_Status_ID = Convert.ToInt32(returnCodePair[1]);

                    if (SMSStatusIDNotSent(receiver.SMS_Status_ID.GetValueOrDefault()))
                    {
                        receiver.Status_ID = (int)MESSAGE_STATUSES.NOT_SENT;
                    }
                    else
                    {
                        receiver.Status_ID = (int)MESSAGE_STATUSES.SENT_UNDELIVERED;
                    }

                    receiver.Updated_On = DateTime.Now;
                    //mrr.EndEdit();
                    //TODO: Update Receiver Information
                    _DataContext.SubmitChanges();
                }
            }
        }
        return(true);
    }
コード例 #13
0
    protected void SaveFamilyDetails()
    {
        //Save information in the database
        OMMDataContext context = new OMMDataContext();

        //int contactID = WebUtil.GetQueryStringInInt("ID");

        //if (tbxSaveUpdate.Text == "Save")
        {
            ContactsNextOfKin conNextOfKin = context.ContactsNextOfKins.FirstOrDefault(P => P.ContactID == _ContactID);
            if (conNextOfKin == null)
            {
                conNextOfKin           = new ContactsNextOfKin();
                conNextOfKin.ContactID = _ContactID;
                context.ContactsNextOfKins.InsertOnSubmit(conNextOfKin);
            }

            conNextOfKin.MothersName = tbxMotherName.Text.Trim();
            //(tbxMotherName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
            //tbxMotherName.Text.ToString().Trim();
            conNextOfKin.FathersName = tbxFatherName.Text.Trim();
            //(tbxFatherName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
            //tbxFatherName.Text.ToString().Trim();
            conNextOfKin.ChildrensNames = tbxChildName.Text.Trim();
            //(tbxChildName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
            //tbxChildName.Text.ToString().Trim();

            conNextOfKin.ChangedByUserID = SessionCache.CurrentUser.ID;
            conNextOfKin.ChangedOn       = DateTime.Now;

            //context.ContactsNextOfKins.InsertOnSubmit(conNextOfKin);
            context.SubmitChanges();
        }
        //if (tbxSaveUpdate.Text == "Update")
        //{
        //    var ContactsNextOfKin = context.ContactsNextOfKins.FirstOrDefault(P => P.ContactID == _ContactID);


        //    if (ContactsNextOfKin == null || _ContactID == 0)
        //    {

        //    }
        //    else
        //    {
        //        ContactsNextOfKin.MothersName =
        //            (tbxMotherName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
        //            tbxMotherName.Text.ToString().Trim();
        //        ContactsNextOfKin.FathersName =
        //            (tbxFatherName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
        //            tbxFatherName.Text.ToString().Trim();
        //        ContactsNextOfKin.ChildrensNames =
        //            (tbxChildName.Text.ToString().Trim().IsNullOrEmpty()) ? "" :
        //            tbxChildName.Text.ToString().Trim();

        //        ContactsNextOfKin.ChangedByUserID = SessionCache.CurrentUser.ID;
        //        ContactsNextOfKin.ChangedOn = System.DateTime.Today;

        //        context.SubmitChanges();
        //    }
        //}


        //ShowSuccessMessage();
        RedirectToShowSuccessMessage();
    }