Example #1
0
 public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     questionDAL        = new QuestionDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     HelperDAL.AddUser(user);
     survey      = new surveys();
     survey.Name = surveyName;
     //survey.users = user;
     survey.User_name   = userName;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
     HelperDAL.AddSurvey(survey);
     question = new questions();
     question.Question_name = questionName;
     question.Surveys_id    = survey.Id;
     question.Input_type_id = 1;
     this.questionDAL.AddQuestion(question);
     this.textAnswerDAL          = new TextAnswerDAL();
     this.textAnswer             = new text_answers();
     this.textAnswer.User_name   = userName;
     this.textAnswer.Question_id = question.Id;
     this.textAnswer.Answer      = TextAnswerText;
 }
Example #2
0
 public static void AddNewSurvey(SekerCotert sekerCotert)
 {
     SurveyHedear surveyHedear   = SurveyConverter.ToDAL(sekerCotert);
     long         surveyHedearId = SurveyDAL.AddNewSurveyHeader(surveyHedear);
     //surveyHedear.SurveyDetails.ToList().ForEach(x => x.SurveyHedearId = surveyHedearId);
     //SurveyDAL.AddNewSurveyDetails(surveyHedear.SurveyDetails);
 }
Example #3
0
        public ActionResult SurveyResults()
        {
            SurveyDAL           dal     = new SurveyDAL(connectionString);
            List <SurveyResult> results = dal.GetSurveysResults();

            return(View("SurveyResults", results));
        }
        public override void BindControl()
        {
            SurveyDAL dal    = new SurveyDAL();
            var       result = dal.GetSurveyBySource(SourceNo, SourceType);

            string        enqNo    = string.Empty;
            List <Survey> surveys2 = new List <Survey>();
            Order         ord      = new Order();

            if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
            {
                ord = new OrderDAL().GetOrderByEnq(SourceNo);
                if (ord != null)
                {
                    surveys2 = dal.GetSurveyBySource(ord.Order_No, SysConst.SourceTypeOrder);
                }
            }
            else if (string.Equals(SourceType, SysConst.SourceTypeOrder, StringComparison.OrdinalIgnoreCase))
            {
                ord = new OrderDAL().GetOrderByNo(SourceNo);
                if (!string.IsNullOrEmpty(ord.EnqNo))
                {
                    var enq = new EnquiryDAL().GetEnquiryByNo(ord.EnqNo);
                    surveys2 = dal.GetSurveyByEnq(enq.Enquiry_No);
                }
            }
            result.AddRange(surveys2);
            result = result.Distinct(new SurveyComparer()).OrderBy(s => s.Survey_No).ToList();
            Utility.BindDataToRepeater(rpSurveyList, result);
        }
 public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     questionDAL        = new QuestionDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     HelperDAL.AddUser(user);
     survey      = new surveys();
     survey.Name = surveyName;
     //survey.users = user;
     survey.User_name   = userName;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
     HelperDAL.AddSurvey(survey);
     question = new questions();
     question.Question_name = questionName;
     question.Surveys_id    = survey.Id;
     question.Input_type_id = 2;
     this.questionDAL.AddQuestion(question);
     this.optionChoicesDAL                 = new OptionChoicesDAL();
     this.optionChoice                     = new option_choices();
     this.optionChoice.Question_id         = question.Id;
     this.optionChoice.Option_choices_name = OptionChoiceName;
 }
        public IActionResult NewSurvey(SurveyResultModel model)
        {
            SurveyDAL myDal = new SurveyDAL();

            myDal.SaveSurvey(model);

            return(RedirectToAction("favorites"));
        }
        public void GetAllSurveysTest()
        {
            ISurveyDAL surveyDal = new SurveyDAL(connString);

            List <Survey> surveys = surveyDal.GetAllSurveyResults();

            Assert.IsNotNull(surveys);
            Assert.AreEqual(3, surveys.Count);
        }
Example #8
0
        protected void btnChangeStatus_Click(object sender, EventArgs e)
        {
            SurveyDAL dal    = new SurveyDAL();
            var       survey = dal.GetSurveyById(SVId);

            AddFollowUp(followUpControl, survey.Status, Utility.GetSelectedText(ddlSurveyStatus));
            survey.Status = Utility.GetSelectedText(ddlSurveyStatus);
            dal.Save();
            SetFocus(btnChangeStatus);
        }
Example #9
0
        public ActionResult Survey()
        {
            SurveyDAL dal = new SurveyDAL(connectionString);

            //creates the dropdown list for parknames
            ViewBag.ParkNameDropdown = dal.ParkNameDropdown();
            Survey s = new Survey();

            return(View("Survey", s));
        }
Example #10
0
        public void TopParksTests()
        {
            SurveyDAL dal = new SurveyDAL(connectionString);


            List <string> s = dal.GetFavoriteParks();

            Assert.IsNotNull(s);
            Assert.AreEqual(topParksCount, s.Count);
        }
Example #11
0
        public static void RemoveSurvey(SekerCotert s)
        {
            // List<SekerPerut> ls = SurveyConverter.ToDTO(SurveyDAL.DeleteSurveyDetails(SurveyConverter.ToDAL(s)).ToList() .;

            SurveyDAL.DeleteSurvey(SurveyConverter.ToDAL(s));


            //user_notification_tbl u = UserNotificationDAL.GetByUsetIdAndNotificationId(n);
            //UserNotificationDAL.RemoveUserNotification(u);
        }
Example #12
0
        public async Task <string> GetPopulatedSurvey(string surveyID)
        {
            SurveyDAL surveyDAL = new SurveyDAL();
            var       survey    = await surveyDAL.GetSurveyData(surveyID);

            if (survey == null)
            {
                return("{\"success\": false, \"body\": \"\"}");
            }
            return("{\"success\": true, \"body\":" + JsonConvert.SerializeObject(survey) + "}");
        }
Example #13
0
        public static List <SekerCotert> GetSurveyByBuildingId(int buildingId)
        {
            return(SurveyConverter.ListToDTO(SurveyDAL.GetSurveyByBuildingId(buildingId)));

            //List<T> u = db.table.where(x => x.user = userid)
            //List<SekerCotert> x =
            //return  Converters.SurveyConverter.ListToDTO(SurveyDAL.GetSurveyByBuildingId(buildingId));
            //x.ForEach(y => y.UserStatus = u.Contains(y.SurveyHedearId.) ? true : false)

            //return x;
        }
Example #14
0
 public void TestInit()
 {
     surveydb           = Database.GetConnection();
     surveyDal          = new SurveyDAL();
     userDAL            = new UserDAL();
     user               = new users();
     user.User_name     = userName;
     user.User_password = password;
     survey             = new surveys();
     survey.Name        = surveyName;
     survey.users       = user;
     SurveyCode         = HelperDAL.GenerateRandomSurveyCode();
     survey.Survey_code = SurveyCode;
 }
Example #15
0
        public static DataSet DeleteQuestion(int CompID, int ContentID)
        {
            DataSet ds = new DataSet();

            try
            {
                ds = SurveyDAL.DeleteQuestion(CompID, ContentID);
            }
            catch (Exception ex)
            {
                Log(ex, System.Reflection.MethodBase.GetCurrentMethod().Name);
            }
            return(ds);
        }
Example #16
0
        public void SubmitSurveyTests()
        {
            SurveyDAL dal = new SurveyDAL(connectionString);

            Survey s = new Survey
            {
                ParkCode      = "YNP",
                Email         = "*****@*****.**",
                State         = "Ohio",
                ActivityLevel = "Sedentary",
            };

            bool newSurvey = dal.SubmitSurvey(s);

            Assert.AreEqual(true, newSurvey);
        }
Example #17
0
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(fileUploadSurveyImg.FileName))
     {
         string serverFilePath = string.Empty;
         Utility.UploadFile(fileUploadSurveyImg, "SurveyImage", SourceNo, ref serverFilePath);
         SurveyDAL dal    = new SurveyDAL();
         var       survey = dal.GetSurveyById(SVId);
         survey.SurveyImageName = Utility.GetFileName(fileUploadSurveyImg);
         survey.SurveyImagePath = serverFilePath;
         dal.Save();
         imgSurveyData.ImageUrl      = Page.ResolveUrl(serverFilePath);
         imgSurveyData.AlternateText = Utility.GetFileName(fileUploadSurveyImg);
     }
     SetFocus(sender);
 }
Example #18
0
        private List <Survey> GetSurveyList()
        {
            SurveyDAL dal    = new SurveyDAL();
            var       result = dal.SearchSurvey(txtSurveyNo.Text,
                                                Utility.GetSelectedText(ddlSurveyMan),
                                                Utility.GetSelectedText(ddlEnqOrdMan),
                                                Utility.GetSelectedText(ddlSurveyStatus),
                                                !string.IsNullOrEmpty(txtBeginDate.Text) ? DateTime.Parse(txtBeginDate.Text) : DateTime.MinValue,
                                                !string.IsNullOrEmpty(txtEndDate.Text) ? DateTime.Parse(txtEndDate.Text) : DateTime.MaxValue,
                                                Utility.GetSelectedText(ddlCompany),
                                                Utility.GetSelectedText(ddlContact),
                                                txtEmail.Text,
                                                txtPhone.Text,
                                                txtQQ.Text);

            return(result);
        }
Example #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string    svNo   = SVNo;
            SurveyDAL dal    = new SurveyDAL();
            var       survey = dal.GetSurveyById(SVId);

            if (!string.IsNullOrEmpty(txtExpectedSurveyDate.Text))
            {
                survey.ExpectedSurveyDate = DateTime.Parse(txtExpectedSurveyDate.Text);
            }
            //update survey
            survey.EnqOrdMan          = Utility.GetSelectedText(ddlEnqOrdMan);
            survey.OnSiteContactName  = txtOnsiteContactName.Text;
            survey.OnSiteContactPhone = txtOnsiteContactPhone.Text;
            survey.SurveyIntro        = txtSurveyIntro.Text;
            AddFollowUp(followUpControl, survey.Status, Utility.GetSelectedText(ddlSurveyStatus));
            survey.Status    = Utility.GetSelectedText(ddlSurveyStatus);
            survey.SurveyMan = Utility.GetSelectedText(ddlSurveyMan);
            //goods
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < chklToos.Items.Count; i++)
            {
                if (chklToos.Items[i].Selected)
                {
                    sb.Append(chklToos.Items[i].Text).Append("|");
                }
            }
            survey.GoodsBring          = sb.ToString();
            survey.CustomerCompanyName = customerInfoControl.CompanyName;
            survey.CustomerContactName = customerInfoControl.ContactName;
            survey.CustomerAddress     = customerInfoControl.Address;
            survey.CustomerEmail       = customerInfoControl.Email;
            survey.CustomerQQ          = customerInfoControl.QQ;
            survey.CustomerPhone1      = customerInfoControl.Phone1;
            survey.CustomerPhone2      = customerInfoControl.Phone2;
            survey.CustomerOthers      = customerInfoControl.Other;

            dal.Save();

            //save new customer
            customerInfoControl.Save();
            this.SetFocus(sender);
        }
Example #20
0
        public ActionResult Survey(Survey survey)
        {
            SurveyDAL dal = new SurveyDAL(connectionString);

            //get park code from the park name selected in dropdown list through method in DAO
            survey.ParkCode           = dal.GetParkCodeForSurvey(survey.ParkName);
            ViewBag.ParkNameDropdown  = dal.ParkNameDropdown();
            ViewBag.StateCodeDropdown = survey.Codes();
            survey.State = survey.GetStateName(survey.StateCode);
            //get state name from statecode method in model

            //if insert works then send to results page
            if (!ModelState.IsValid)
            {
                return(View("Survey", survey));
            }
            dal.InsertSurvey(survey);
            return(RedirectToAction("SurveyResults"));
        }
        protected void rpEnqList_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Enquiry      enq  = e.Item.DataItem as Enquiry;
                RefineDAL    rDal = new RefineDAL();
                SurveyDAL    sDal = new SurveyDAL();
                QuotationDAL qDal = new QuotationDAL();

                Repeater rpRefinement = e.Item.FindControl("rpRefinement") as Repeater;
                Utility.BindDataToRepeater(rpRefinement, rDal.GetRefineBySource(SysConst.SourceTypeEnquiry, enq.Enquiry_No));

                Repeater rpSurvey = e.Item.FindControl("rpSurvey") as Repeater;
                Utility.BindDataToRepeater(rpSurvey, sDal.GetSurveyBySource(enq.Enquiry_No, SysConst.SourceTypeEnquiry));

                Repeater rpQuoationa = e.Item.FindControl("rpQuoation") as Repeater;
                Utility.BindDataToRepeater(rpQuoationa, qDal.GetQuotesBySource(SysConst.SourceTypeEnquiry, enq.Enquiry_No));

                FollowUpTop3UserControl followUp = e.Item.FindControl("followUpTop3UserControl") as FollowUpTop3UserControl;
                UIUtility.BindUserControl(followUp, SysConst.SourceTypeEnquiry, ((Enquiry)e.Item.DataItem).Enquiry_No);
            }
        }
Example #22
0
        public void GetSurveys()
        {
            // Arrange
            // initializes a new SurveyDAL with the connectionString parameter
            SurveyDAL surveyDal = new SurveyDAL(connectionString);

            // Act
            // runs the GetSurveys method to get a FavoriteParks object (which is a list of surveys
            // grouped by # of surveys for each park) from the survey_result table
            List <FavoriteParks> surveys = surveyDal.GetSurveys();

            // Assert
            // Checks to make sure the FavoritePark object is no longer empty
            Assert.IsTrue(surveys.Count > 0);

            // Assert
            // Checks to make sure the last FavoritePark object is for the test park which
            // we made in the Initialize method above; the GetSurveys method sorts by the
            // count of surveys (descending), then alphabetically by park name (ascending), so in this case the
            // test park would only show up once, and alphabetically would be last, so it should be the last
            // entry in the list
            Assert.AreEqual("ZZZ", surveys[surveys.Count - 1].ParkCode);
        }
Example #23
0
        public void PostSurveyTest()
        {
            // Arrange
            // initializes a new SurveyDAL with the connectionString parameter
            SurveyDAL surveyDal = new SurveyDAL(connectionString);

            // Act
            // creates a new list of surveys and adds a mock survey (never committed
            // to the DB, just used for testing)
            List <Survey> surveys   = new List <Survey>();
            Survey        newSurvey = new Survey()
            {
                ParkCode      = "ZZZ",
                EmailAddress  = "*****@*****.**",
                State         = "Ohio",
                ActivityLevel = "Active"
            };

            // Assert
            // the PostSurvey method returns a bool, so we check to make sure the bool
            // is true, meaning the PostSurvey method has succeeded
            Assert.IsTrue(surveyDal.PostSurvey(newSurvey));
        }
Example #24
0
 public static void AddSurvey(Survey survey)
 {
     SurveyDAL.Add(Converters.SurveyConverter.ToDAL(survey));
 }
Example #25
0
        //public static List<Survey> GetAll()
        //{
        //    return Converters.SurveyConverter.ListToDTO(SurveyDAL.Get());
        //}
        //public static Survey GetById(int id)
        //{
        //    return Converters.SurveyConverter.ToDTO(SurveyDAL.GetById(id));
        //}

        public static void ChangeStatus(SekerCotert s)
        {
            //return  Converters.SurveyConverter.ToDTO(SurveyDAL.ChangeStatus(Converters.SurveyConverter.ToDAL(s)));

            SurveyDAL.ChangeStatus(SurveyConverter.ToDAL(s));
        }
        protected void btnCreateSurvey_Click(object sender, EventArgs e)
        {
            //get no
            SeedDAL sdal = new SeedDAL();
            string  no   = sdal.GetNoByTableName(SysConst.TableSurvey, SysConst.SuffixSuvey);
            //get enqordman
            string enqOrdMan   = string.Empty;
            string companyName = string.Empty;
            string contact     = string.Empty;
            string address     = string.Empty;
            string email       = string.Empty;
            string qq          = string.Empty;
            string phone1      = string.Empty;
            string phone2      = string.Empty;
            string other       = string.Empty;
            string surveyIntro = string.Empty;
            string enqNo       = string.Empty;

            List <LineItem> items    = new List <LineItem>();
            int             sourceId = -1;

            if (string.Equals(SourceType, SysConst.SourceTypeEnquiry, StringComparison.OrdinalIgnoreCase))
            {
                EnquiryDAL enqDAL = new EnquiryDAL();
                var        enq    = enqDAL.GetEnquiryByNo(SourceNo);
                enqOrdMan   = enq.EnqMan;
                companyName = enq.CustomerCompanyName;
                contact     = enq.CustomerContactName;
                address     = enq.CustomerAddress;
                email       = enq.CustomerEmail;
                qq          = enq.CustomerQQ;
                phone1      = enq.CustomerPhone1;
                phone2      = enq.CustomerPhone2;
                other       = enq.CustomerOthers;
                surveyIntro = enq.SurveyIntro;
                enqNo       = SourceNo;
                sourceId    = enq.Enquiry_Id;
                //update enq status
                enq.Status = "申请测量";
                enqDAL.Save();
            }
            if (string.Equals(SourceType, SysConst.SourceTypeSalesOrder, StringComparison.OrdinalIgnoreCase))
            {
                OrderDAL soDAL = new OrderDAL();
                var      so    = soDAL.GetOrderByNo(SourceNo);
                enqOrdMan   = so.OrderMan;
                companyName = so.CustomerCompanyName;
                contact     = so.CustomerContactName;
                address     = so.CustomerAddress;
                email       = so.CustomerEmail;
                qq          = so.CustomerQQ;
                phone1      = so.CustomerPhone1;
                phone2      = so.CustomerPhone2;
                other       = so.CustomerOthers;
                surveyIntro = so.SurveyIntro;
                enqNo       = so.EnqNo;
                sourceId    = so.Order_Id;
                //update ord status
                so.Status = "申请测量";
                soDAL.Save();
            }
            //new refine
            SurveyDAL dal    = new SurveyDAL();
            Survey    survey = new Survey()
            {
                Survey_No           = no,
                Status              = FirstStatusConsts.Survey,
                EnqOrdMan           = enqOrdMan,
                SourceType          = SourceType,
                SourceNo            = SourceNo,
                CreatedDate         = DateTime.Now,
                CreatedAt           = DateTime.Now,
                CreatedBy           = SMSContext.Current.User.UserName,
                CustomerCompanyName = companyName,
                CustomerContactName = contact,
                CustomerAddress     = address,
                CustomerEmail       = email,
                CustomerQQ          = qq,
                CustomerPhone1      = phone1,
                CustomerPhone2      = phone2,
                CustomerOthers      = other,
                SurveyIntro         = surveyIntro,
                EnqNo = enqNo
            };

            dal.AddSurvey(survey);
            dal.Save();

            LineItemDAL lDAL = new LineItemDAL();

            items = lDAL.GetLineItemsBySource(sourceId, SourceType);
            foreach (var item in items)
            {
                LineItem target = new LineItem()
                {
                    Intro      = item.Intro,
                    Name       = item.Name,
                    OriginNo   = item.OriginNo,
                    Project    = item.Project,
                    Quantity   = item.Quantity,
                    Remark     = item.Remark,
                    SourceId   = survey.Survey_Id,
                    SourceType = SysConst.SourceTypeSurvey,
                    Spec       = item.Spec,
                    Unit       = item.Unit,
                    UnitPrice  = item.UnitPrice
                };
                lDAL.AddLineItem(target);
            }
            lDAL.Save();
            int    svid   = survey.Survey_Id;
            string svno   = survey.Survey_No;
            string url    = Page.ResolveUrl(string.Format("~/SurveyForm.aspx?svid={0}&svno={1}&sourcetype={2}&sourceno={3}", svid, svno, SourceType, SourceNo));
            string script = string.Format("<script>window.open('{0}')</script>", url);

            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "createsuvey", script);
            BindControl();
            SetFocus(btnCreateSurvey);
        }
Example #27
0
 public SurveyController()
 {
     surveyDal = new SurveyDAL(connectionString);
 }
Example #28
0
 public static List <Survey> GetAll()
 {
     return(Converters.SurveyConverter.ListToDTO(SurveyDAL.Get()));
 }
Example #29
0
 public static Survey GetById(int id)
 {
     return(Converters.SurveyConverter.ToDTO(SurveyDAL.GetById(id)));
 }
Example #30
0
        public static void UpdateCountAnswer(SekerPerut s)
        {
            //return  Converters.SurveyConverter.ToDTO(SurveyDAL.ChangeStatus(Converters.SurveyConverter.ToDAL(s)));

            SurveyDAL.UpdateCountAnswer(SurveyConverter.ToDAL(s));
        }