Beispiel #1
0
        public myCustomerDTOCtl()
        {
            InitializeComponent();

            current = null;
            bdsAddresses = null;
        }
 void CustomerServiceClient_GetCustomerCompleted(object sender, GetCustomerCompletedEventArgs e)
 {
     _customer = e.Result.Customer;
     this.RaisePropertyChanged(cust=> cust.Customer);
     //InvokePropertyChanged(new PropertyChangedEventArgs("Customer"));
     DataLoaded = true;
 }
    private void FillGridWithCustomerDetails(int mandatoryDocId, string documentNo)
    {
        IList<CustomerDTO> lstCustomerDTO = new List<CustomerDTO>();

        if (Convert.ToInt32(mandatoryDocId) == 0)
        {
            CustomerDTO customerDetails = new CustomerDTO();
            customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(documentNo);

            if (customerDetails.Cust_Id > 0)
            {
                int agentId = Convert.ToInt32(customerDetails.Cust_AgentId);

                switch (agentId)
                {
                    case 20:
                        customerDetails.Cust_AgentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentShortNameByAgentId(agentId);
                        break;
                    case 21:
                        customerDetails.Cust_AgentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentShortNameByAgentId(agentId);
                        break;
                    case 22:
                        customerDetails.Cust_AgentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentShortNameByAgentId(agentId);
                        break;
                    case 23:
                        customerDetails.Cust_AgentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentShortNameByAgentId(agentId);
                        break;
                    case 24:
                        customerDetails.Cust_AgentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentShortNameByAgentId(agentId);
                        break;
                }

                lstCustomerDTO.Add(customerDetails);
            }

        }
        else
        {
            CustomerDocDetailsDTO docDetails = new CustomerDocDetailsDTO();
            docDetails = ESalesUnityContainer.Container.Resolve<ICustomerDocService>().GetCustomerByDocumentId(mandatoryDocId, documentNo);

            if (docDetails.Cust_Doc_Customer != null)
            {
                lstCustomerDTO.Add(docDetails.Cust_Doc_Customer);
            }
        }

        if (lstCustomerDTO.Count > 0)
        {

            grdDCACustomersAssociation.DataSource = lstCustomerDTO;
            grdDCACustomersAssociation.DataBind();

        }
        else
        {
            ShowBlankGrid();
        }
    }
 private void UpdateCustomer(CustomerDTO customerDTO)
 {
     using (var session = SessionFactory.OpenSession())
     using (var transaction = session.BeginTransaction())
     {
         var customer = session.Get<Customer>(customerDTO.Id);
         customer.FirstName = customerDTO.FirstName;
         customer.LastName = customerDTO.LastName;
         transaction.Commit();
     }
 }
Beispiel #5
0
        private void Initialize(object sender, EventArgs e)
        {
            CustomerDTO c1 = new CustomerDTO();
            c1.Code = "c1";
            c1.Name = "c1_name";
            c1.address1 = "a1";
            c1.address2 = "a2";
            c1.address3 = "a3";
            c1.address4 = "a4";
            c1.city = "a_city";

            CustomerDTO c2 = new CustomerDTO();
            c2.Code = "c2";
            c2.Name = "c2_name";
            c2.address1 = "a1";
            c2.address2 = "a2";
            c2.address3 = "a3";
            c2.address4 = "a4";
            c2.city = "a_city";

            CustomerDTO c3 = new CustomerDTO();
            c3.Code = "c3";
            c3.Name = "c3_name";
            c3.address1 = "a1";
            c3.address2 = "a2";
            c3.address3 = "a3";
            c3.address4 = "a4";
            c3.city = "a_city";
            CustomerDTO c4 = new CustomerDTO();
            c4.Code = "c4";
            c4.Name = "c4_name";
            c4.address1 = "a1";
            c4.address2 = "a2";
            c4.address3 = "a3";
            c4.address4 = "a4";
            c4.city = "a_city";
            CustomerDTO c5 = new CustomerDTO();
            c5.Code = "c5";
            c5.Name = "c5_name";
            c5.address1 = "a1";
            c5.address2 = "a2";
            c5.address3 = "a3";
            c5.address4 = "a4";
            c5.city = "a_city";

            lstCustomerDTO.Add(c1);
            lstCustomerDTO.Add(c2);
            lstCustomerDTO.Add(c3);
            lstCustomerDTO.Add(c4);
            lstCustomerDTO.Add(c5);

            myAddressCtl1.bdsAddresses.DataSource = lstCustomerDTO;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="VMCustomer"/> class.
        /// </summary>
        /// <param name="current">The current customer.</param>
        public VMCustomer(CustomerDTO current)
        {
            editCommand = new DelegateCommand<object>(EditExecute);
            backCommand = new DelegateCommand<object>(BackExecute);
            _currentCustomerOrders = new ObservableCollection<OrderListDTO>();

            if (!DesignTimeHelper.IsDesignTime)
            {
                Customer = current;
                GetCustomerOrders();
            }
        }
        public void MappingObject_WithSamePropertyTypeAndNames_ShouldFillTheResultPropertyValues_WithOnesFromSource_AndKeepTheExistingSetOnesIntact()
        {
            const string actual = "YO";

            var customerDTO = new CustomerDTO { Id = actual };

            var customer = new Fixture().CreateAnonymous<Customer>();

            Mapper<CustomerDTO, Customer>.MapByPropertyConventionModifiyingExisting(customerDTO, customer);

            Assert.Equal(customer.Name, customer.Name);
            Assert.Equal(customer.Id, actual);
            Assert.Equal(customer.LoginDate, customer.LoginDate);
        }
    private void FillGridWithAuthRepDetails(int mandatoryDocId, string documentNo)
    {
		CustomerDTO customer = new CustomerDTO();
		if (Convert.ToInt32(mandatoryDocId) == 0)
		{
			CustomerDTO customerDetails = new CustomerDTO();
			customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(documentNo);
			if (customerDetails.Cust_Id > 0)
			{
				customer = customerDetails;
			}
		}
		else
		{
			CustomerDocDetailsDTO doctype = new CustomerDocDetailsDTO();
			doctype = ESalesUnityContainer.Container.Resolve<ICustomerDocService>().GetCustomerByDocumentId(mandatoryDocId, documentNo);
			
			if (doctype.Cust_Doc_Customer != null)
			{
				customer = doctype.Cust_Doc_Customer;
			}
		}

		if (customer.Cust_Id>0)
        {
            IList<AuthRepDTO> lstAuthRepDetailsDTO = (ESalesUnityContainer.Container.Resolve<IAuthRepService>()
					.GetAuthRepDetailsForCustomer(customer.Cust_Id));

			ViewState[Globals.StateMgmtVariables.CUSTOMERID] = customer.Cust_Id;
			ViewState[Globals.StateMgmtVariables.CUSTFOLDERNAME] = customer.Cust_FolderName;

            if (lstAuthRepDetailsDTO.Count > 0)
            {
                grdManageAuthRep.DataSource = lstAuthRepDetailsDTO;
                grdManageAuthRep.DataBind();
            }
            else
            {
                FillBlankGrid();
            }
        }
        else
        {
            FillBlankGrid();
        }
    }
    private void SetReportParametersForCustomers(CustomerDTO customerDTO, ReportViewer reportViewer)
    {
        ReportParameter Cust_TradeName = new ReportParameter("Cust_FirmName", customerDTO.Cust_FirmName);
        ReportParameter Cust_OwnerName = new ReportParameter("Cust_OwnerName", customerDTO.Cust_OwnerName);
        ReportParameter Cust_RegisteredAddress = new ReportParameter("Cust_RegisteredAddress", customerDTO.Cust_RegisteredAddress);
        ReportParameter Cust_UnitAddress = new ReportParameter("Cust_UnitAddress", customerDTO.Cust_UnitAddress);
        ReportParameter Cust_Pincode = new ReportParameter("Cust_Pincode", Convert.ToString(customerDTO.Cust_Pincode));
        ReportParameter Cust_State = new ReportParameter("Cust_State", customerDTO.Cust_State_Name);
        ReportParameter Cust_District = new ReportParameter("Cust_District", customerDTO.Cust_District_Name);
        ReportParameter Cust_Landmark = new ReportParameter("Cust_Landmark", customerDTO.Cust_Landmark);
        ReportParameter Cust_PhoneNo = new ReportParameter("Cust_PhoneNo", customerDTO.Cust_PhoneNo);
        ReportParameter Cust_MobileNo = new ReportParameter("Cust_MobileNo", customerDTO.Cust_MobileNo);
        ReportParameter Cust_OwnershipStatus = new ReportParameter("Cust_OwnershipStatus", Convert.ToString(customerDTO.Cust_OwnershipName));
        ReportParameter Cust_FatherName = new ReportParameter("Cust_FatherName", customerDTO.Cust_FathersName);
        ReportParameter Cust_AMEVisitDate = new ReportParameter("Cust_AMEVisitDate", Convert.ToDateTime(customerDTO.Cust_AMEVisitDate).ToString("dd MMM yyyy"));
        ReportParameter Cust_BusinessType = new ReportParameter("Cust_BusinessType", customerDTO.Cust_Business_Name);
        ReportParameter Cust_SalesType = new ReportParameter("Cust_SalesType", customerDTO.Cust_SalesType == 1 ? "Within Jharkhand" : "Outside Jharkhand");

        reportViewer.LocalReport.SetParameters(new ReportParameter[] {Cust_TradeName, Cust_OwnerName, Cust_RegisteredAddress,
             Cust_UnitAddress, Cust_Pincode, Cust_State, Cust_District, Cust_Landmark, Cust_PhoneNo, Cust_MobileNo, 
             Cust_OwnershipStatus, Cust_FatherName, Cust_AMEVisitDate, Cust_BusinessType, Cust_SalesType });
    }
    private void FillDropdownWithCustomerDetails(int mandatoryDocId, string documentNo)
    {
        IList<CustomerDTO> lstCustomerDTO = new List<CustomerDTO>();

        if (Convert.ToInt32(mandatoryDocId) == 0)
        {
            CustomerDTO customerDetails = new CustomerDTO();
            customerDetails = ESalesUnityContainer.Container.Resolve<ICautionListService>().GetCustomerDetailsByCode(documentNo);
            if (customerDetails.Cust_Id > 0)
            {
                lstCustomerDTO.Add(customerDetails);
            }
        }
        else
        {
            CustomerDocDetailsDTO docDetails = new CustomerDocDetailsDTO();
            docDetails = ESalesUnityContainer.Container.Resolve<ICautionListService>().GetCustomerByDocumentId(mandatoryDocId, documentNo);

            if (docDetails.Cust_Doc_Customer != null)
            {
                lstCustomerDTO.Add(docDetails.Cust_Doc_Customer);
            }
        }

        if (lstCustomerDTO.Count > 0)
        {
            PopulateCustCautionList();
            DropDownList ddlCustomerName = (DropDownList)grdCustCautionLstMaster.FooterRow.FindControl("ddlCustomerName");
            ddlCustomerName.DataSource = lstCustomerDTO;
            ddlCustomerName.DataBind();
            ddlCustomerName.Items.Insert(0, new ListItem(Messages.SelectCustomer, "0"));
        }
        else
        {
            PopulateCustCautionList();
            // ShowBlankGrid();
        }
    }
	/// <summary>
	/// 
	/// </summary>
	private void FillGridWithCustomerDetails(int mandatoryDocId, string documentNo)
	{
		IList<CustomerDTO> lstCustomerDTO = new List<CustomerDTO>();

		if (Convert.ToInt32(mandatoryDocId) == 0)
		{
			CustomerDTO customerDetails = new CustomerDTO();
			customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(documentNo);
			if (customerDetails.Cust_Id > 0)
			{
				lstCustomerDTO.Add(customerDetails);
			}
			
		}
		else
		{
			CustomerDocDetailsDTO docDetails = new CustomerDocDetailsDTO();
			docDetails = ESalesUnityContainer.Container.Resolve<ICustomerDocService>().GetCustomerByDocumentId(mandatoryDocId, documentNo);

			if (docDetails.Cust_Doc_Customer != null)
			{
				lstCustomerDTO.Add(docDetails.Cust_Doc_Customer);
			}
		}

		if (lstCustomerDTO.Count > 0)
		{

			grdManageCustomers.DataSource = lstCustomerDTO;
			grdManageCustomers.DataBind();
			ViewState[Globals.StateMgmtVariables.TRADENAME] = lstCustomerDTO[0].Cust_TradeName;
		}
		else
		{
			FillBlankGrid();
		}
	}
Beispiel #12
0
 private void CreateDefault()
 {
     //create default customer information
     _currentCustomer = new CustomerDTO();
     CompanyName      = "Company Name Here...";
 }
Beispiel #13
0
 public void ChangeCustomer(CustomerDTO customer)
 {
     repo.UpdateCustomer(MapDTO.Map <Customer, CustomerDTO>(customer));
 }
Beispiel #14
0
 public void tblCustomer_Update(CustomerDTO dt)
 {
     ctDao.tblCustomer_Update(dt);
 }
        public void IsRightFormatTestFunction(string id, string name, string address, string phoneNumber, string email, bool result)
        {
            CustomerDTO customer = new CustomerDTO(id, name, address, phoneNumber, email, 0);

            Assert.AreEqual(CustomerBUS.Instance.IsRightFormat(customer), result);
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        CustomerDTO ctDTO = new CustomerDTO();
        int groupID = int.Parse(drlMailGroup.SelectedValue.ToString());
        int CustomerID = 0;
        int count = 0;
        int err = 0;
        long countEmail = 0;
        try
        {
            for (int i = 0; i < dtlCustomer.Items.Count; i++)
            {
                DataListItem item = dtlCustomer.Items[i];
                CheckBox chkXoa = (CheckBox)item.FindControl("chkCheck");
                Label lblName = (Label)item.FindControl("lblName");
                Label lblGender = (Label)item.FindControl("lblGender");
                Label lblBirthDay = (Label)item.FindControl("lblBirthDay");
                Label lblEmail = (Label)item.FindControl("lblEmail");
                Label lblPhone = (Label)item.FindControl("lblPhone");
                Label lblAddr = (Label)item.FindControl("lblAddr");
                InitBUS();
                if (chkXoa.Checked == true && EmailTools.IsEmail(lblEmail.Text.Trim()))
                {
                    try
                    {
                        ConnectionData.OpenMyConnection();
                        ctDTO.Name = (lblName.Text == null || lblName.Text == "") ? "Không có" : lblName.Text;
                        ctDTO.Email = lblEmail.Text.Trim();
                        ctDTO.BirthDay = (lblBirthDay.Text == null || lblBirthDay.Text == "") ? DateTime.Now : DateTime.Parse(lblBirthDay.Text);
                        ctDTO.Gender = (lblGender.Text == null || lblGender.Text == "") ? "Không có" : lblGender.Text;
                        ctDTO.Phone = (lblPhone.Text == null || lblPhone.Text == "") ? "Không có" : lblPhone.Text;
                        ctDTO.Address = (lblAddr.Text == null || lblAddr.Text == "") ? "Không có" : lblAddr.Text;
                        ctDTO.City = "";
                        ctDTO.Job = "";
                        ctDTO.Company = "";
                        ctDTO.Country = "";
                        ctDTO.Province = "";
                        ctDTO.Fax = "";
                        ctDTO.SecondPhone = "";
                        ctDTO.Type = "";
                        ctDTO.UserID = getUserLogin().UserId;
                        ctDTO.createBy = getUserLogin().UserId;
                        ctDTO.AssignTo = int.Parse(drlMailGroup.SelectedItem.Value);
                        count++;

                        DataTable checkExistsMail = ctBUS.GetByEmail(lblEmail.Text, getUserLogin().UserId);
                        if (checkExistsMail.Rows.Count > 0)
                        {
                            CustomerID = int.Parse(checkExistsMail.Rows[0]["Id"].ToString());
                        }
                        else
                        {

                            if (getUserLogin().DepartmentId == 2)
                            {
                                table = ctBUS.GetClientId(getUserLogin().UserId);
                            }
                            else
                            {
                                table = ctBUS.GetClientIdSub(getUserLogin().UserId);
                            }

                            if (table.Rows.Count > 0)
                            {
                                int clienID = int.Parse(table.Rows[0]["clientId"].ToString());
                                DataTable dtCountEmail = ctBUS.GetCountEmail(clienID);
                                if (dtCountEmail.Rows[0]["isUnLimit"] + "" != "" || Convert.ToBoolean(dtCountEmail.Rows[0]["isUnLimit"])) countEmail = 1000000000000000000;
                                countEmail = int.Parse(dtCountEmail.Rows[0]["under"].ToString());

                            }

                            int statusclient = int.Parse(table.Rows[0]["Status"].ToString());
                            DateTime NgayHetHan = Convert.ToDateTime(table.Rows[0]["expireDate"].ToString());
                            string todays = DateTime.Now.ToString("yyyy-MM-dd");
                            DateTime today = Convert.ToDateTime(todays);
                            DateTime expireDay = Convert.ToDateTime(NgayHetHan);
                            DataTable dtEmail = ctBUS.GetCountCustomerCreatedMail(getUserLogin().UserId);
                            int numbermail = int.Parse(dtEmail.Rows[0]["numberMail"].ToString());
                            if (statusclient == 2 || expireDay < today)
                            {
                                lblError.Text = "Thời gian đăng ký của bạn đã hết hạn, Vui lòng liên hệ quản trị hoặc vào thông tin tài khoản để gia hạn thêm!";
                                pnSuccess.Visible = false;
                                pnError.Visible = true;
                                break;
                            }
                            else
                            {
                                if (numbermail < countEmail)
                                {
                                    CustomerID = ctBUS.tblCustomer_insert(ctDTO);
                                }
                                else
                                {
                                    lblError.Text = "Vượt quá hạng ngạch tạo khách hàng!";
                                    pnSuccess.Visible = false;
                                    pnError.Visible = true;
                                }
                            }

                        }

                        if (dgBUS.GetByID(groupID, CustomerID).Rows.Count > 0)
                        {
                            count--;
                            err++;
                        }
                        else
                        {
                            DetailGroupDTO dgDTO = new DetailGroupDTO();
                            dgDTO.GroupID = groupID;
                            dgDTO.CustomerID = CustomerID;
                            dgDTO.CountReceivedMail = 0;
                            dgDTO.LastReceivedMail = DateTime.Now;
                            dgBUS.tblDetailGroup_insert(dgDTO);
                        }
                        ConnectionData.OpenMyConnection();
                    }
                    catch (Exception exx)
                    {
                        logs.Error(userLogin.Username + "-Add Customer - btnSave_Click", exx);
                        continue;
                    }

                }
            }
            if (count != 0 || err != 0)
            {
                Visible(false);
                pnSuccess.Visible = true;
                lblSuccess.Text = "- Bạn đã thêm thành công " + count + " khách hàng vào nhóm: " + drlMailGroup.SelectedItem.ToString() + " </br> - Trùng :" + err.ToString() + " khách hàng.";

                // Update limit send and create customer.
                updateLimitSendAndCreate(count, 0);
            }
        }
        catch (Exception ex)
        {

            logs.Error(userLogin.Username + "-Client - btnSave_Click", ex);
        }
    }
Beispiel #17
0
 private void AddCustomerDTOToOrdersListViewModel(OrdersViewModel ordersListViewModel, CustomerDTO customerDTO)
 {
     ordersListViewModel.Customer.IsValidCustomer = (customerDTO.CustomerId > 0);
     ordersListViewModel.Customer.CustomerId      = customerDTO.CustomerId;
     ordersListViewModel.Customer.FirstName       = customerDTO.FirstName;
     ordersListViewModel.Customer.LastName        = customerDTO.LastName;
     ordersListViewModel.Customer.Address         = customerDTO.Address;
     ordersListViewModel.Customer.City            = customerDTO.City;
     ordersListViewModel.Customer.StateCode       = customerDTO.StateCode;
     ordersListViewModel.Customer.PostalCode      = customerDTO.PostalCode;
 }
Beispiel #18
0
 internal static void Logout()
 {
     CurrentUser = null;
 }
Beispiel #19
0
 /// <summary>
 /// Metodo utilizado para asignar propiedades adicionales de un dto en el codigo manual
 /// </summary>
 /// <param name="entity">Entidad de la cual se toman las propiedades</param>
 /// <param name="dto">DTO en el cual se asignaron las propiedades adicionales</param>
 partial void SetDTOExtras(Customer entity, ref CustomerDTO dto);
Beispiel #20
0
        public async Task <IActionResult> Register(CustomerDTO model, bool repair = false)
        {
            if (ModelState.IsValid)
            {
                if (!repair)
                {
                    if (string.IsNullOrEmpty(model.username))
                    {
                        model.username = model.email;
                    }
                    if (!model.isDhiMember)
                    {
                        model.citizenId = null;
                    }
                    if (this.isExistIDCard(model))
                    {
                        var rg = new RijndaelCrypt();

                        model.ShowIdcardDupPopup = true;
                        var ducus = this._context.Customers.Include(i => i.User).Where(c => c.IDCard == model.citizenId & (model.ID > 0 ? c.ID != model.ID : true));
                        model.dupEmail = new List <string>();
                        model.dupFBID  = new List <string>();
                        foreach (var cus in ducus)
                        {
                            if (string.IsNullOrEmpty(cus.FacebookID))
                            {
                                model.dupEmail.Add(cus.User.UserName);
                            }
                            else
                            {
                                model.dupFBID.Add(cus.User.UserName);
                            }

                            model.dupIdcard = model.citizenId;
                        }
                        ModelState.AddModelError("citizenId", "รหัสบัตรประชาชนซ้ำในระบบ");
                    }
                    if (this.isExistEmail(model))
                    {
                        ModelState.AddModelError("email", "อีเมลซ้ำในระบบ");
                    }
                    if (this.isExistUserName(model))
                    {
                        ModelState.AddModelError("email", "รหัสผู้ใช้งานซ้ำในระบบ");
                    }
                    //if (this.isExistMobileNo(model))
                    //   ModelState.AddModelError("moblieNo", "เบอร์โทรศัพท์ซ้ำในระบบ");
                    //if (this.isExistName(model))
                    //{
                    //   ModelState.AddModelError("firstName", "ชื่อนามสกุลซ้ำในระบบ");
                    //   ModelState.AddModelError("lastName", "ชื่อนามสกุลซ้ำในระบบ");
                    //}
                    if (!string.IsNullOrEmpty(model.friendCode) && !this.isExistFriendCode(model))
                    {
                        ModelState.AddModelError("friendCode", "ไม่พบข้อมูล friend Code");
                    }
                }

                if (ModelState.IsValid)
                {
                    if (model.valid)
                    {
                        model.password = DataEncryptor.Decrypt(model.pEncyprt);
                        var customer = new Customer();
                        customer.Create_On     = DateUtil.Now();
                        customer.ChannelUpdate = CustomerChanal.TIP;
                        customer = CustomerBinding.Binding(customer, model);

                        GetCustomerClass(customer);
                        customer.Create_On = DateUtil.Now();
                        customer.Create_By = customer.User.UserName;
                        customer.Update_On = DateUtil.Now();
                        customer.Update_By = customer.User.UserName;
                        customer.Success   = false;
                        var regs = this.GetPointCondition(customer, TransacionTypeID.Register);
                        foreach (var item in regs)
                        {
                            if (item.Point.Value > 0)
                            {
                                var point = this.GetCustomerPoint(item, customer, item.Point.Value, (int)TransacionTypeID.Register, CustomerChanal.TIP, "tipsociety-register");
                                customer.CustomerPoints.Add(point);
                            }
                        }
                        var      friendpoint = 0;
                        Customer friend      = null;
                        if (!string.IsNullOrEmpty(customer.FriendCode))
                        {
                            var invites = this.GetPointCondition(customer, TransacionTypeID.InviteFriend);
                            foreach (var item in invites)
                            {
                                var p = this.GetPoint(item, customer);
                                if (p > 0)
                                {
                                    var point = this.GetCustomerPoint(item, customer, p, (int)TransacionTypeID.InviteFriend, CustomerChanal.TIP, "tipsociety-register");
                                    friend = this._context.Customers.Where(w => w.RefCode == customer.FriendCode).FirstOrDefault();
                                    if (friend != null)
                                    {
                                        friendpoint      = p;
                                        point.CustomerID = friend.ID;
                                        this._context.CustomerPoints.Add(point);
                                    }
                                }
                            }
                        }
                        this._context.Customers.Add(customer);
                        this._context.SaveChanges();
                        this._context.Entry(customer).GetDatabaseValues();
                        customer.RefCode = CustomerBinding.GetRefCode(customer);
                        this._context.Users.Attach(customer.User);
                        this._context.Entry(customer.User).Property(u => u.Email).IsModified       = true;
                        this._context.Entry(customer.User).Property(u => u.PhoneNumber).IsModified = true;
                        this._context.Update(customer);
                        this._context.SaveChanges();

                        AddConsent(model);

                        if (_conf.SendEmail == true && friend != null && friendpoint > 0)
                        {
                            await MailInviteFriend(friend.Email, friend, customer, friendpoint);
                        }
                        try
                        {
                            if (!repair)
                            {
                                using (var client = new HttpClient())
                                {
                                    client.BaseAddress = new Uri(_mobile.Url + "/rewardpoint/customerprofile/register");
                                    client.DefaultRequestHeaders.Accept.Clear();
                                    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                                    var rg = new RijndaelCrypt();
                                    model.username = rg.Encrypt(model.username);
                                    model.password = rg.Encrypt(model.password);
                                    model.status   = customer.Status.toStatusNameEn();

                                    StringContent content = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8, "application/json");

                                    HttpResponseMessage response = await client.PostAsync(client.BaseAddress, content);

                                    if (response.IsSuccessStatusCode && response.StatusCode == HttpStatusCode.OK)
                                    {
                                        customer.Success = true;
                                        this._context.SaveChanges();
                                    }
                                    else
                                    {
                                        _logger.LogWarning(JsonConvert.SerializeObject(model));
                                        _logger.LogWarning(await response.Content.ReadAsStringAsync());
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        if (_conf.SendEmail == true)
                        {
                            await MailActivateAcc(customer.Email, customer.ID);
                        }

                        //if (_conf.SendSMS == true)
                        //   SendSMS(customer.ID);

                        return(await Login(new Login()
                        {
                            UserName = model.email, Password = model.password
                        }, true));
                    }
                    else
                    {
                        model.pEncyprt = DataEncryptor.Encrypt(model.password);
                    }
                    model.valid = true;
                }
            }
            return(View(model));
        }
Beispiel #21
0
        private async Task <bool> AddConsent(CustomerDTO model)
        {
            _logger.LogWarning("Consent Receipts Start");
            var oauth = await GetToken();

            var token      = model.token;
            var identifier = model.moblieNo + "|" + model.firstName + "|" + model.lastName;

            if (!string.IsNullOrEmpty(oauth.token))
            {
                var jwttoken = GetCollection(oauth.token, model.collectionPointGuid);
                if (!string.IsNullOrEmpty(jwttoken))
                {
                    using (var client = new HttpClient())
                    {
                        client.BaseAddress = new Uri(_conf.OneTrustConsentUrl + "/request/v1/consentreceipts");
                        client.DefaultRequestHeaders.Accept.Clear();
                        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                        var model2 = new AddConsentDTO();
                        model2.identifier         = identifier;
                        model2.requestInformation = jwttoken;
                        model2.purposes           = new PurposesConsentDTO[] { new PurposesConsentDTO()
                                                                               {
                                                                                   Id = model.purposeid,
                                                                                   TransactionType = model.consent
                                                                               } };
                        model2.dsDataElements = new dsDataElementsDTO()
                        {
                            Name        = model.firstName,
                            LastName    = model.lastName,
                            Email       = model.email,
                            MobilePhone = model.moblieNo,
                            //Website = "tipsociety"
                        };
                        StringContent content = new StringContent(JsonConvert.SerializeObject(model2), Encoding.UTF8, "application/json");

                        // HTTP POST
                        HttpResponseMessage response = await client.PostAsync(client.BaseAddress, content);

                        if (response.IsSuccessStatusCode && response.StatusCode == HttpStatusCode.OK)
                        {
                            using (HttpContent HttpContent = response.Content)
                            {
                                string MyContent = HttpContent.ReadAsStringAsync().Result;
                            }
                            _logger.LogWarning("Consent Receipts Success");

                            return(true);
                        }
                        else
                        {
                            using (HttpContent HttpContent = response.Content)
                            {
                                string MyContent = HttpContent.ReadAsStringAsync().Result;
                            }
                            _logger.LogWarning("Consent Receipts Fail");
                            return(false);
                        }
                    }
                }
            }
            _logger.LogWarning("Consent Receipts Fail");
            return(false);
        }
        public HttpResponseMessage UpdateCustomer(HttpRequestMessage request, [FromBody] CustomerDTO customerDTO)
        {
            CustomersApiModel        customersWebApiModel = new CustomersApiModel();
            TransactionalInformation transaction          = new TransactionalInformation();
            CustomersBusinessService customersBusinessService;

            customersWebApiModel.IsAuthenicated = true;

            if (customerDTO.CustomerCode == null)
            {
                customerDTO.CustomerCode = string.Empty;
            }
            if (customerDTO.CompanyName == null)
            {
                customerDTO.CompanyName = string.Empty;
            }
            if (customerDTO.Address == null)
            {
                customerDTO.Address = string.Empty;
            }
            if (customerDTO.City == null)
            {
                customerDTO.City = string.Empty;
            }
            if (customerDTO.Region == null)
            {
                customerDTO.Region = string.Empty;
            }
            if (customerDTO.PostalCode == null)
            {
                customerDTO.PostalCode = string.Empty;
            }
            if (customerDTO.Country == null)
            {
                customerDTO.Country = string.Empty;
            }
            if (customerDTO.PhoneNumber == null)
            {
                customerDTO.PhoneNumber = string.Empty;
            }
            if (customerDTO.WebSiteUrl == null)
            {
                customerDTO.WebSiteUrl = string.Empty;
            }

            customersBusinessService = new CustomersBusinessService(customersDataService);

            Customer customer = customersBusinessService.UpdateCustomer(
                customerDTO.CustomerID,
                customerDTO.CustomerCode,
                customerDTO.CompanyName,
                customerDTO.Address,
                customerDTO.City,
                customerDTO.Region,
                customerDTO.PostalCode,
                customerDTO.Country,
                customerDTO.PhoneNumber,
                customerDTO.WebSiteUrl,
                out transaction);

            if (transaction.ReturnStatus == false)
            {
                customersWebApiModel.ReturnMessage    = transaction.ReturnMessage;
                customersWebApiModel.ReturnStatus     = transaction.ReturnStatus;
                customersWebApiModel.ValidationErrors = transaction.ValidationErrors;
                var badResponse = Request.CreateResponse <CustomersApiModel>(HttpStatusCode.BadRequest, customersWebApiModel);
                return(badResponse);
            }

            customersWebApiModel.ReturnStatus  = transaction.ReturnStatus;
            customersWebApiModel.ReturnMessage = transaction.ReturnMessage;
            customersWebApiModel.Customer      = customer;

            var response = Request.CreateResponse <CustomersApiModel>(HttpStatusCode.OK, customersWebApiModel);

            return(response);
        }
 public List <NoteDTO> GetCustomersNotes(CustomerDTO customer)
 {
     return(_client.GetNotes(customerGuid: customer.Guid).Select(sn => _client.GetNote(sn.Guid)).ToList());
 }
 private CustomerDTO GetCustomerDTO()
 {
     CustomerDTO ctDTO = new CustomerDTO();
     ctDTO.Name = this.txtName.Text;
     ctDTO.Gender = this.drlGender.Text;
     ctDTO.BirthDay = DateTime.Parse(this.txtBirthday.Text);
     ctDTO.Phone = this.txtPhoneNumber.Text;
     ctDTO.Address = txtAddress.Text;
     ctDTO.Email = this.txtEmail.Text;
     ctDTO.SecondPhone = this.txtSecondPhone.Text;
     ctDTO.Province = "";
     ctDTO.Type = "";
     ctDTO.Fax = "";
     ctDTO.Country = "";
     ctDTO.Company = "";
     ctDTO.City = "";
     ctDTO.Id = CustomerID;
     return ctDTO;
 }
        public HttpResponseMessage Update(CustomerDTO customerDTO)
        {
            try
            {
                var curDateTime = DateTime.UtcNow;
                var customer    = _IOrgcustService.GetOrgcusts().Where(p => p.Org.Id == customerDTO.Id).FirstOrDefault();
                int userID      = int.Parse(Request.Headers.GetValues("userId").FirstOrDefault());

                if (customer != null)
                {
                    customer.Org.Name            = customerDTO.Name;
                    customer.Org.Descript        = customerDTO.Descript;
                    customer.Org.Comments        = customerDTO.Comments;
                    customer.Org.SOAccountNbr    = customerDTO.CustomerNbr;
                    customer.Org.OtherAccountNbr = customerDTO.OtherAccountNbr;

                    customer.Org.Agreement = customerDTO.Agreement;
                    customer.Org.Logo      = customerDTO.Logo;

                    customer.Org.PromoCode    = customerDTO.PromoCode;
                    customer.Org.BillMe       = customerDTO.BillMe;
                    customer.Org.BillingInfo  = customerDTO.BillingInfo;
                    customer.Org.ImageCleanUp = customerDTO.ImageCleanUp;
                    customer.SLA            = customerDTO.SLA;
                    customer.RemoveBlank    = customerDTO.RemoveBlank;
                    customer.SubmissionOpts = customerDTO.SubmissionOpts;

                    customer.Org.SOW          = customerDTO.SOW;
                    customer.Org.GotAgreement = customerDTO.GotAgreement;

                    customer.Org.ModifiedDate   = DateTime.UtcNow;
                    customer.Org.ModifiedUserId = userID;

                    var locn = _IOrglocnService.GetOrglocns().Where(p => p.Org.Id == customer.Org.Id);
                    if (locn.Count() > 0)
                    {
                        customer.Org.OrgLocns.FirstOrDefault().Locn.AddressLine1 = customerDTO.AddressLine1;
                        customer.Org.OrgLocns.FirstOrDefault().Locn.AddressLine2 = customerDTO.AddressLine2;
                        customer.Org.OrgLocns.FirstOrDefault().Locn.City = customerDTO.City;
                        customer.Org.OrgLocns.FirstOrDefault().Locn.State = customerDTO.State;
                        customer.Org.OrgLocns.FirstOrDefault().Locn.ZipCode = customerDTO.ZipCode;
                    }
                    else
                    {
                        customer.Org.OrgLocns.Add(new OrgLocn()
                        {
                            Org = customer.Org, Locn = new Locn()
                            {
                                AddressLine1 = customerDTO.AddressLine1, AddressLine2 = customerDTO.AddressLine2, City = customerDTO.City, State = customerDTO.State, ZipCode = customerDTO.ZipCode
                            }
                        });
                    }

                    if (customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault() != null)
                    {
                        if (customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().UserId == customerDTO.ContactId)
                        {
                            customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per.Title = customerDTO.Title;
                        }
                        else
                        {
                            customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().Type = null;
                            customer.Org.OrgUsers.Where(p => p.UserId == customerDTO.ContactId).FirstOrDefault().Type = "Primary";
                            customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per.Title     = customerDTO.Title;
                        }
                    }
                    else if (customer.Org.OrgUsers.Where(p => p.Type == null).FirstOrDefault() != null)
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == null).FirstOrDefault().UserId         = customerDTO.ContactId;
                        customer.Org.OrgUsers.Where(p => p.Type == null).FirstOrDefault().User.Per.Title = customerDTO.Title;
                        customer.Org.OrgUsers.Where(p => p.Type == null).FirstOrDefault().Type           = "Primary";
                    }

                    if (customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per.PersContacts.Where(b => b.Contact.ContactTyp.DisplayName == "Phone").Count() > 0)
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per.PersContacts.Where(b => b.Contact.ContactTyp.DisplayName == "Phone").FirstOrDefault().Contact.Value = customerDTO.Phone;
                    }
                    else
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per.PersContacts.Add(new PersContact()
                        {
                            Per = customer.Org.OrgUsers.Where(p => p.Type == "Primary").FirstOrDefault().User.Per, Contact = new Contact()
                            {
                                ContactTypId = 2, Value = customerDTO.Phone
                            }
                        });
                    }



                    if (customerDTO.SalesRepId == 0)
                    {
                        if (customer.Org.OrgUsers.Where(p => p.Type == "SalesRep").Count() > 0)
                        {
                            customer.Org.OrgUsers.Remove(customer.Org.OrgUsers.Where(p => p.Type == "SalesRep").FirstOrDefault());
                        }
                    }
                    else if (customer.Org.OrgUsers.Where(p => p.Type == "SalesRep").FirstOrDefault() != null)
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == "SalesRep").FirstOrDefault().UserId = (int)customerDTO.SalesRepId;
                    }
                    else
                    {
                        customer.Org.OrgUsers.Add(new OrgUser()
                        {
                            Org = customer.Org, UserId = (int)customerDTO.SalesRepId, Type = "SalesRep"
                        });
                    }


                    if (customerDTO.CustomerCareId == 0)
                    {
                        if (customer.Org.OrgUsers.Where(p => p.Type == "CustomerCare").Count() > 0)
                        {
                            customer.Org.OrgUsers.Remove(customer.Org.OrgUsers.Where(p => p.Type == "CustomerCare").FirstOrDefault());
                        }
                    }
                    else if (customer.Org.OrgUsers.Where(p => p.Type == "CustomerCare").FirstOrDefault() != null)
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == "CustomerCare").FirstOrDefault().UserId = (int)customerDTO.CustomerCareId;
                    }
                    else
                    {
                        customer.Org.OrgUsers.Add(new OrgUser()
                        {
                            Org = customer.Org, UserId = (int)customerDTO.CustomerCareId, Type = "CustomerCare"
                        });
                    }

                    if (customerDTO.ResellerRepId == 0 || customerDTO.ResellerRepId == null)
                    {
                        if (customer.Org.OrgUsers.Where(p => p.Type == "ResellerRep").Count() > 0)
                        {
                            customer.Org.OrgUsers.Remove(customer.Org.OrgUsers.Where(p => p.Type == "ResellerRep").FirstOrDefault());
                        }
                    }
                    else if (customer.Org.OrgUsers.Where(p => p.Type == "ResellerRep").FirstOrDefault() != null)
                    {
                        customer.Org.OrgUsers.Where(p => p.Type == "ResellerRep").FirstOrDefault().UserId = (int)customerDTO.ResellerRepId;
                    }
                    else
                    {
                        customer.Org.OrgUsers.Add(new OrgUser()
                        {
                            Org = customer.Org, UserId = (int)customerDTO.ResellerRepId, Type = "ResellerRep"
                        });
                    }

                    var OrgStatHist = customer.Org.OrgStatusHists.OrderByDescending(s => s.Id).FirstOrDefault();
                    if (OrgStatHist != null && (OrgStatHist.OrgTypOrgStatu.OrgStatus.DisplayText != customerDTO.StatusName))
                    {
                        var curOrgStatus = _IOrgtyporgstatusService.GetOrgtyporgstatus().Where(p => p.OrgStatus.DisplayText == customerDTO.StatusName).FirstOrDefault();
                        if (curOrgStatus != null)
                        {
                            customer.Org.OrgStatusHists.Add(new OrgStatusHist()
                            {
                                Org = customer.Org, OrgTypOrgStatu = curOrgStatus, CreateDate = DateTime.UtcNow
                            });
                        }
                        if (customerDTO.StatusName == "Active")
                        {
                            customer.Org.ApprovedUserId = userID;
                            customer.Org.ApprovedDate   = DateTime.UtcNow;
                            customer.Org.InactiveUserId = null;
                            customer.Org.InactiveDate   = null;

                            customer.Org.WkflowInstances.FirstOrDefault().WkflowStepHists.Add(new WkflowStepHist
                            {
                                CreateDate    = DateTime.UtcNow,
                                DateLastMaint = DateTime.UtcNow,
                                WkflowStatId  = 1,
                                CreatedUserId = userID
                            });
                        }
                        else if (customerDTO.StatusName == "Suspended")
                        {
                            customer.Org.InactiveUserId = userID;
                            customer.Org.InactiveDate   = DateTime.UtcNow;
                        }
                    }

                    _IOrgcustService.UpdateOrgcust(customer);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Customer could not be found"));
                }
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }


            return(Request.CreateResponse <bool>(HttpStatusCode.OK, true));
        }
Beispiel #26
0
 public CreateCustomerCommand(CustomerDTO customer)
 {
     Customer = customer;
 }
        public IEnumerable <OrderDto> GetOrdersByCustomerId(int customerId)
        {
            var customerOrders = from customers in _context.Customers
                                 join orders in _context.Orders
                                 on customers.Id
                                 equals orders.CustomerId
                                 where customers.Id == customerId
                                 select orders;
            var orderList   = new List <OrderDto>();
            var itemList    = new List <OrderItemDto>();
            var productList = new List <ProductDto>();
            var orderDto    = new OrderDto();

            foreach (var item in customerOrders)
            {
                var customer = new CustomerDTO
                {
                    City      = item.Customer.City,
                    Country   = item.Customer.Country,
                    FirstName = item.Customer.FirstName,
                    LastName  = item.Customer.LastName,
                    Phone     = item.Customer.Phone
                };

                orderDto.OrderDate   = item.OrderDate;
                orderDto.OrderNumber = item.OrderNumber;
                orderDto.TotalAmount = item.TotalAmount;

                orderList.Add(orderDto);
                foreach (var prd in item.OrderItems)
                {
                    var orderItem = new OrderItemDto();
                    orderItem.OrderId   = prd.OrderId;
                    orderItem.ProductId = prd.ProductId;
                    orderItem.Quantity  = prd.Quantity;
                    orderItem.UnitPrice = prd.UnitPrice;

                    var product = new ProductDto();
                    product.Id             = prd.Product.Id;
                    product.IsDiscontinued = prd.Product.IsDiscontinued;
                    product.Package        = prd.Product.Package;
                    product.ProductName    = prd.Product.ProductName;

                    productList.Add(product);
                }
            }

            //select new OrderDto
            //{
            //    Customer =
            //        new CustomerDTO
            //        {
            //            FirstName = customers.FirstName,
            //            LastName = customers.LastName,
            //            Phone = customers.Phone,
            //            City = customers.City,
            //            Country = customers.Country,
            //            Id = customers.Id
            //        }
            //};

            //var orderDto = customerOrders;
            return(orderList);
        }
        private Task <HttpResponseMessage> PostAsync(CustomerDTO customer)
        {
            var content = ToHttpContent(customer);

            return(_client.PostAsync("/api/Customer", content));
        }
    protected void btnValidateSave_Click(object sender, EventArgs e)
    {
        CustomerDTO customerDetails = new CustomerDTO();
        customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(txtCustomerCode.Text.Trim());
        if (customerDetails.Cust_Id > 0)
        {

            SetBankDetails(customerDetails);
            IList<CustomerMaterialMapDTO> custMaterial = ESalesUnityContainer.Container.Resolve<ICustomerMaterialService>().GetCustomerMaterialDetailsByCustomerId(customerDetails.Cust_Id);
            int x = ESalesUnityContainer.Container.Resolve<ICustomerService>().SaveAndUpdateCustomerDetails(customerDetails, custMaterial);
            ucMessageBoxForGrid.ShowMessage(Messages.CustomerDetailsUpdatedSuccessfully);
            ResetFields();
            ResetFieldStatus(false);
            SetAccountPanelVisiblity(false);
        }
    }
 Customer Create(CustomerDTO customerDTO)
 {
     return(new Customer(new Name(...), new PostalAdress(...)));
 }
Beispiel #31
0
 public void Update(CustomerDTO customer)
 {
     _logic.Update(customer);
 }
        public void Post([FromBody] CustomerDTO customer)
        {
            var c = _mapper.Map <Customer>(customer);

            _customerService.AddCustomer(c);
        }
Beispiel #33
0
 public int tblCustomer_insert(CustomerDTO dt)
 {
     return ctDao.tblCustomer_insert(dt);
 }
        public void Put(Guid id, [FromBody] CustomerDTO customer)
        {
            var c = _mapper.Map <Customer>(customer);

            _customerService.UpdateCustomer(c);
        }
Beispiel #35
0
 public CustomerDTO ChangeCustomer(CustomerDTO customer)
 {
     return(_customerDAL.UpdateCustomer(customer));
 }
    /// <summary>
    /// Event to validate the Sms
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void smsValidate_Click(object sender, EventArgs e)
    {
        string CustomerBusinessType = string.Empty;
        string CustomerTruckType = string.Empty;
        string customerTruckTypeName = string.Empty;
        txtTotalBookingAdvance.Text = string.Empty;
        txtBalanceAdvance.Text = string.Empty;
        txtAdvanceAmount.Text = string.Empty;

        List<CounterDTO> lstCounterData = ESalesUnityContainer.Container.Resolve<ICounterService>().GetCounterList().ToList();
        List<CounterDetailsDTO> lstCounterDetailsData = ESalesUnityContainer.Container.Resolve<ICounterService>().GetCounterDetailsListForCurrentDate().ToList();

        IList<int> lstMaterialAllocations = ESalesUnityContainer.Container.Resolve<IDcaMaterialAllocationService>()
                    .GetAllMaterialAllocationAgentIDList(DateTime.Now.Date);

        var query = from counter in lstCounterData
                    join material in lstMaterialAllocations.Select(k => k) on
                    counter.Counter_Agent_Id equals material
                    select counter.Counter_Id;

        var loggedCounters = lstCounterDetailsData.FindAll(T => query.ToList().Contains(T.CounterDetail_Counter_ID));

        ViewState["MobileNo"] = txtPhoneNumber.Text.Trim();

        if (query.ToList().Count == loggedCounters.ToList().Count)
        {
            IList<CustomerDTO> lstCustomer = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByMobileNumber(txtPhoneNumber.Text.Trim());

            SMSRegistrationDTO smsRegDetails = ESalesUnityContainer.Container.Resolve<ISMSService>().GetTodaysSMSDetailsById(Convert.ToInt32(txtSmsRegNo.Text), DateTime.Now.Date.AddDays(-1));
            CustomerDTO customer = new CustomerDTO();
            if (lstCustomer.Count > 0 && smsRegDetails.SMSReg_Id > 0)
            {
                customer = (from F in lstCustomer
                            where F.Cust_Code == smsRegDetails.SMSReg_Cust_Code
                            select F).FirstOrDefault();
            }
            if (customer.Cust_Id > 0 && smsRegDetails.SMSReg_Id > 0 && smsRegDetails.SMSReg_Booking_Id == null)
            {
                string TruckTypeCheck = ConfigurationManager.AppSettings["TruckTypeCheck"].ToLower();

                if (TruckTypeCheck == "booking")
                {
                    CustomerBusinessType = customer.Cust_Business_Name;
                    if (CustomerBusinessType != "Bricks ")
                    {
                        // Only for Non-Brick Customers

                        IList<LiftingLimitDTO> LstLimitDTO = ESalesUnityContainer.Container.Resolve<ILiftingLimit>().GetLimitList();
                        foreach (LiftingLimitDTO l in LstLimitDTO)
                        {
                            if (l.LiftingLimit_Business_Name != "Bricks ")
                            {
                                ViewState[Globals.StateMgmtVariables.CUSTOMERTRUCKTYPE] = l.LiftingLimit_TruckRegType_Id;
                                ViewState[Globals.StateMgmtVariables.CUSTOMERTRUCKTYPENAME] = l.LiftingLimit_TruckRegType_Name;
                            }
                        }

                        if (ViewState[Globals.StateMgmtVariables.CUSTOMERTRUCKTYPE] != null)
                        {
                            CustomerTruckType = ViewState[Globals.StateMgmtVariables.CUSTOMERTRUCKTYPE].ToString();
                            customerTruckTypeName = ViewState[Globals.StateMgmtVariables.CUSTOMERTRUCKTYPENAME].ToString();

                            TruckVerificationDTO truckDetails = ESalesUnityContainer.Container.Resolve<ITruckService>().GetAllTruckDetails(smsRegDetails.SMSReg_TruckNo.Trim());

                            if (truckDetails.Truck_Id > 0)
                            {
                                long truckTypes = truckDetails.type;
                                if (Convert.ToInt32(CustomerTruckType) != truckTypes)
                                {
                                    ucMessageBox.ShowMessage("Only " + customerTruckTypeName + " are allowed for Hardcoke Customers.");
                                }
                                else
                                {

                                    GetCustomerDetails(customer.Cust_Code);
                                    if (truckDetails.type == 1)
                                    {
                                        GetTruckDetail(truckDetails.Truck_Id.ToString(), false);
                                        ddlTruck.SelectedValue = truckDetails.Truck_Id.ToString();
                                        rdStandAlone.SelectedValue = "1";
                                    }
                                    else
                                    {
                                        GetTruckDetail(truckDetails.Truck_RegNo, true);
                                        rdStandAlone.SelectedValue = "2";
                                    }
                                    //Validat for avaliable balance
                                    {

                                    }

                                }
                            }
                            // Sms send on Invalid truck or truck not registered
                            else
                            {
                                ucMessageBox.ShowMessage("Truck not registered");
                            }
                        }
                    }
                    else
                    {
                        // Only for Brick Customer
                        ValidatingTruckAndCustomer(smsRegDetails.SMSReg_TruckNo.Trim(), customer.Cust_Code);
                    }
                }
                else
                {
                    ValidatingTruckAndCustomer(smsRegDetails.SMSReg_TruckNo.Trim(), customer.Cust_Code);
                }

            }
            else
            {
                //Reset controls on page to default state
                ResetFields();
                if (customer.Cust_Id > 0)
                {
                    ucMessageBox.ShowMessage("SMS ID already used");
                }
                else
                {
                    ucMessageBox.ShowMessage(Messages.CustomerNotFound);
                }
            }
        }
        else
        {
            ucMessageBox.ShowMessage("All counters are not  Active for today");
        }

    }
Beispiel #37
0
        //-------------------------------------------------------------------------------------Edit or Delete
        private void validateCustomerBtn_Click(object sender, EventArgs e)
        {
            if (!CustomerCedulaTX.Text.Equals("") && RNCTX.Text.Equals("") || RNCTX.Text.Equals("N/A")) //Es persona fisica
            {
                if (validations.checkCedula(CustomerCedulaTX.Text))                                     //If valid cedula
                {
                    CustomerDTO customer = FillCustomerDTO();

                    ValidationContext        validation = new ValidationContext(customer, null, null);
                    IList <ValidationResult> errors     = new List <ValidationResult>();

                    if (!Validator.TryValidateObject(customer, validation, errors, true)) //Form validations
                    {
                        foreach (ValidationResult result in errors)
                        {
                            MessageBox.Show(result.ErrorMessage);
                        }
                    }
                    else
                    {
                        if (dao.GetCustomerById(CustomerCedulaTX.Text, RNCTX.Text) && validateCustomerBtn.Text.Equals(createCustomerParam)) //Check duplicity
                        {
                            MessageBox.Show("Esta persona fisica ya existe en el sistema!");
                        }
                        else
                        {
                            if (validateCustomerBtn.Text.Equals(createCustomerParam)) //Create the customer
                            {
                                dao.ADD(customer);
                                MessageBox.Show("SUCCESS : Cliente creado!");

                                //Refresh data and reset form....
                                ReopenForm();
                            }
                            else if (validateCustomerBtn.Text.Equals(editCustomerParam)) //Edit the customer
                            {
                                dao.EDIT(customer);
                                MessageBox.Show("SUCCESS : cliente editado correctamente!");

                                //Refresh data and reset form...
                                ReopenForm();
                            }
                            else
                            {
                                MessageBox.Show("ERROR : probleamas al ejecutar la operacion.");
                            }
                        }
                    }
                }
                else //No valid cedula.
                {
                    MessageBox.Show("Cedula invalida, favor corregir para proceder.");
                }
            }
            else if (CustomerCedulaTX.Text.Equals("") || CustomerCedulaTX.Text.Equals("N/A") && !RNCTX.Text.Equals("")) // Es juridica
            {
                //if (validations.checkRNC(RNCTX.Text)) //If valid RNC
                //{
                CustomerDTO customer = FillCustomerDTO();

                ValidationContext        validation = new ValidationContext(customer, null, null);
                IList <ValidationResult> errors     = new List <ValidationResult>();

                if (!Validator.TryValidateObject(customer, validation, errors, true)) //Form validations
                {
                    foreach (ValidationResult result in errors)
                    {
                        MessageBox.Show(result.ErrorMessage);
                    }
                }
                else
                {
                    if (dao.GetCustomerById(CustomerCedulaTX.Text, RNCTX.Text) && validateCustomerBtn.Text.Equals(createCustomerParam)) //Check duplicity
                    {
                        MessageBox.Show("Esta persona juridica ya existe en el sistema!");
                    }
                    else
                    {
                        if (validateCustomerBtn.Text.Equals(createCustomerParam)) //Create the customer
                        {
                            dao.ADD(customer);
                            MessageBox.Show("SUCCESS : Cliente creado!");

                            //Refresh data and reset form....
                            ReopenForm();
                        }
                        else if (validateCustomerBtn.Text.Equals(editCustomerParam)) //Edit the customer
                        {
                            dao.EDIT(customer);
                            MessageBox.Show("SUCCESS : cliente editado correctamente!");

                            //Refresh data and reset form...
                            ReopenForm();
                        }
                        else
                        {
                            MessageBox.Show("ERROR : probleamas al ejecutar la operacion.");
                        }
                    }
                }
                //   }
                //else //No valid cedula.
                //{
                //  MessageBox.Show("RNC invalido, favor corregir para proceder.");
                //    }
            }
        }
Beispiel #38
0
 // the default logic to handle the code_changed event
 private void CodeChanged(object sender, EventArgs e)
 {
     Code = cboCode.Text;
     if (Code != String.Empty)
     {
         current =
           (CustomerDTO)cboCode.SelectedItem;
         Current = current;
     }
     else { current = null; }
 }
Beispiel #39
0
 public CustomerDTO AddCustomers(CustomerDTO customer)
 {
     repo.CreateCustomer(MapDTO.Map <Customer, CustomerDTO>(customer));
     return(customer);
 }
    private void FillGridCombo(string TruckNo)
    {
        StandaloneTrucksDTO truckDetails = new StandaloneTrucksDTO();
        truckDetails = ESalesUnityContainer.Container.Resolve<IStandaloneTruckService>().GetStandaloneTruckByRegNo(TruckNo);

        CustomerDTO customerDetails = new CustomerDTO();
        customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(txtCustomerCode.Text.Trim());

        if (!string.IsNullOrEmpty(customerDetails.Cust_Code))//customer exists
        {
            if (truckDetails.StandaloneTruck_Id > 0)// truckNo exists
            {
                if (!truckDetails.StandaloneTruck_IsBlacklisted)// Not Already CautionListed
                {
                    ListItem li = ddlFooterTruckRegNo.Items.FindByValue(truckDetails.StandaloneTruck_Id.ToString());
                    if (li == null)
                    {
                        ddlFooterTruckRegNo.Items.Add(new ListItem(truckDetails.StandaloneTruck_RegNo, truckDetails.StandaloneTruck_Id.ToString().Trim()));
                    }
                    else
                    {
                        ucMessageBoxForGrid.ShowMessage("This truck no is already verified.");
                    }
                }
                else
                {
                    ucMessageBoxForGrid.ShowMessage("This truck no is already in caution list.");
                }
            }
            else
            {
                ucMessageBoxForGrid.ShowMessage(Resources.Messages.TruckDetailsDoesNotExist);
            }
        }
        else
        {
            ucMessageBoxForGrid.ShowMessage("This customer code does not exist.");
        }
    }
Beispiel #41
0
        // GET: Customer/Details/5
        public ActionResult Details(int id)
        {
            CustomerDTO customer = mgr.GetCustomer(id);

            return(View(customer));
        }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            InitBUS();
            Visible(false);
            int GroupID = 0;
            if (drlGroup.SelectedIndex >= 0)
            {
                GroupID = int.Parse(drlGroup.SelectedValue.ToString());
            }
            int CustomerID = 0;
            string message = checkInputCustomer();
            if (message != "")
            {
                pnError.Visible = true;
                lblError.Text = message;
            }
            else
            {
                ConnectionData.OpenMyConnection();
                CustomerDTO ctDTO = new CustomerDTO();
                ctDTO.Address = this.txtAddress.Text;
                ctDTO.BirthDay = convertStringToDate(txtBirthday.Text);
                ctDTO.City = "";
                ctDTO.Company = "";
                ctDTO.Country = "";
                ctDTO.Email = txtEmail.Text.Trim();
                ctDTO.Fax = "";
                ctDTO.Gender = drlGender.SelectedItem.ToString();
                ctDTO.Name = txtName.Text;
                ctDTO.Phone = this.txtPhone.Text;
                ctDTO.Province = "";
                ctDTO.SecondPhone = txtHomePhone.Text;
                ctDTO.Type = "";
                ctDTO.UserID = getUserLogin().UserId;
                ctDTO.createBy = getUserLogin().UserId;
                DataTable table = null;
                if (drlGroup.SelectedIndex >= 0)
                {
                    ctDTO.AssignTo = int.Parse(drlGroup.SelectedValue.ToString());
                }
                long countEmail = 0;
                //them moi
                if (hdfCustomerId.Value == null || hdfCustomerId.Value == "")
                {
                    if (getUserLogin().DepartmentId == 2)
                    {
                        table = ctBUS.GetClientId(getUserLogin().UserId);
                    }
                    else
                    {
                        table = ctBUS.GetClientIdSub(getUserLogin().UserId);
                    }

                    if (table.Rows.Count > 0)
                    {
                        int clienID = int.Parse(table.Rows[0]["clientId"].ToString());
                        DataTable dtCountEmail = ctBUS.GetCountEmail(clienID);
                        if (dtCountEmail.Rows[0]["isUnLimit"] + "" != "" && Convert.ToBoolean(dtCountEmail.Rows[0]["isUnLimit"])) countEmail = 1000000000000000000;
                        else countEmail = int.Parse(dtCountEmail.Rows[0]["under"].ToString());
                    }

                    int statusclient = int.Parse(table.Rows[0]["Status"].ToString());
                    DataTable dtEmail = ctBUS.GetCountCustomerCreatedMail(getUserLogin().UserId);
                    int numbermail = int.Parse(dtEmail.Rows[0]["numberMail"].ToString());
                    DateTime NgayHetHan = Convert.ToDateTime(table.Rows[0]["expireDate"].ToString());
                    //string todays = DateTime.Now.ToString("yyyy-MM-dd");
                    DateTime today = DateTime.Now.Date;
                    DateTime expireDay = Convert.ToDateTime(NgayHetHan);
                    DataTable checkEmail = ctBUS.GetCheckEmailByUserId(txtEmail.Text.Trim(), userLogin.UserId);

                    if (statusclient == 2 || expireDay < today)
                    {
                        lblError.Text = "Thời gian đăng ký của bạn đã hết hạn, Vui lòng liên hệ quản trị hoặc vào thông tin tài khoản để gia hạn thêm!";
                        pnSuccess.Visible = false;
                        pnError.Visible = true;
                        return;
                    }
                    else
                    {
                        if (numbermail < countEmail)
                        {

                            if (checkEmail.Rows.Count > 0)
                            {
                                pnSuccess.Visible = false;
                                pnError.Visible = true;
                                lblError.Text = "Email đã được sử dụng. Vui lòng chọn email khác !";
                                this.txtEmail.Focus();
                            }
                            else
                            {
                                CustomerID = ctBUS.tblCustomer_insert(ctDTO);
                                if (dgBUS.GetByID(GroupID, CustomerID).Rows.Count > 0)
                                {
                                    pnSuccess.Visible = false;
                                    pnError.Visible = true;
                                    lblError.Text = "Khách hàng này đã tồn tại trong nhóm này !";
                                }
                                else
                                {
                                    DetailGroupDTO dgDTO = new DetailGroupDTO();
                                    dgDTO.GroupID = GroupID;
                                    dgDTO.CustomerID = CustomerID;
                                    dgDTO.CountReceivedMail = 0;
                                    dgDTO.LastReceivedMail = DateTime.Now;
                                    dgBUS.tblDetailGroup_insert(dgDTO);
                                    pnError.Visible = false;
                                    pnSuccess.Visible = true;
                                    lblSuccess.Text = "Bạn đã thêm thành công 1 khách hàng vào nhóm: " + drlGroup.SelectedItem.ToString();

                                    // Update limit send and create.
                                    updateLimitSendAndCreate(1, 0);
                                    setTextDefault();
                                }
                            }
                        }
                        else
                        {
                            lblError.Text = "Vượt quá hạng ngạch tạo khách hàng!";
                            pnSuccess.Visible = false;
                            pnError.Visible = true;
                        }
                    }

                }
                //update
                else
                {

                    CustomerID = int.Parse(this.CustomerID.Value.ToString());
                    GroupID = int.Parse(drlGroup.SelectedValue.ToString());
                    ctDTO.Id = int.Parse(this.CustomerID.Value.ToString());
                    // CustomerID = int.Parse(ctBUS.GetByEmail(txtEmail.Text).Rows[0]["Id"].ToString());
                    DataTable checkEmail = ctBUS.GetEmailByUser(CustomerID, txtEmail.Text.Trim());
                    if (checkEmail.Rows.Count > 0)
                    {
                        pnSuccess.Visible = false;
                        pnError.Visible = true;
                        lblError.Text = "Email đã được sử dụng. Vui lòng chọn email khác !";
                        this.txtEmail.Focus();
                    }
                    else
                    {
                        ctBUS.tblCustomer_Update(ctDTO);
                        pnError.Visible = false;
                        pnSuccess.Visible = true;
                        lblSuccess.Text = "Bạn đã cập nhật thành công 1 khách hàng";
                    }
                    //if (dgBUS.GetByID(GroupID, CustomerID).Rows.Count > 0)
                    //{
                    //    pnSuccess.Visible = false;
                    //    pnError.Visible = true;
                    //    lblError.Text = "Khách hàng này đã tồn tại trong nhóm này !";
                    //}
                    //else
                    //{
                    //    DetailGroupDTO dgDTO = new DetailGroupDTO();
                    //    dgDTO.GroupID = GroupID;
                    //    dgDTO.CustomerID = CustomerID;
                    //    dgDTO.LastReceivedMail = DateTime.Now;
                    //    dgBUS.tblDetailGroup_insert(dgDTO);
                    //    pnError.Visible = false;
                    //    pnSuccess.Visible = true;
                    //    lblSuccess.Text = "Bạn đã cập nhật thành công 1 khách hàng vào nhóm: " + drlGroup.SelectedItem.ToString();

                    //    // Update limit send and create.
                    //    updateLimitSendAndCreate(1, 0);
                    //}
                }

                //tam edit
                //  if (this.CustomerID.Value.ToString() == "")
                // {
                ///    DataTable tblCheckByEmail = ctBUS.GetByEmail(txtEmail.Text);
                //    if (tblCheckByEmail.Rows.Count > 0)
                //    {
                //      CustomerID = int.Parse(tblCheckByEmail.Rows[0]["Id"].ToString());
                //    ctDTO.Id = CustomerID;
                //     ctBUS.tblCustomer_Update(ctDTO);
                //   pnError.Visible = false;
                //   pnSuccess.Visible = true;
                //lblSuccess.Text = "Bạn đã cập nhật thông thành công 1 khách hàng ! <br/>";
                //   }

                //tamhm edit
                //else
                //{
                //    CustomerID = ctBUS.tblCustomer_insert(ctDTO);
                //}

                //if (dgBUS.GetByID(GroupID, CustomerID).Rows.Count > 0)
                //{
                //    pnSuccess.Visible = false;
                //    pnError.Visible = true;
                //    lblError.Text = "Khách hàng này đã tồn tại trong nhóm này !";
                //}
                //else
                //{
                //    DetailGroupDTO dgDTO = new DetailGroupDTO();
                //    dgDTO.GroupID = GroupID;
                //    dgDTO.CustomerID = CustomerID;
                //    dgDTO.CountReceivedMail = 0;
                //    dgDTO.LastReceivedMail = DateTime.Now;
                //    dgBUS.tblDetailGroup_insert(dgDTO);
                //    pnError.Visible = false;
                //    pnSuccess.Visible = true;
                //    lblSuccess.Text = "Bạn đã thêm thành công 1 khách hàng vào nhóm: " + drlGroup.SelectedItem.ToString();

                //    // Update limit send and create.
                //    updateLimitSendAndCreate(1, 0);
                //}
                // }
                // else
                //  {
                //   CustomerID = int.Parse(this.CustomerID.Value.ToString());
                //   GroupID = int.Parse(drlGroup.SelectedValue.ToString());
                //   ctDTO.Id = int.Parse(this.CustomerID.Value.ToString());
                //   CustomerID = int.Parse(ctBUS.GetByEmail(txtEmail.Text).Rows[0]["Id"].ToString());
                //   ctBUS.tblCustomer_Update(ctDTO);
                //   pnError.Visible = false;
                //   pnSuccess.Visible = true;
                ////   lblSuccess.Text = "Bạn đã cập nhật thông thành công 1 khách hàng ! <br/>";
                //   if (dgBUS.GetByID(GroupID, CustomerID).Rows.Count > 0)
                //   {
                //       pnSuccess.Visible = false;
                //       pnError.Visible = true;
                //       lblError.Text = "Khách hàng này đã tồn tại trong nhóm này !";
                //   }
                //   else
                //   {
                //       DetailGroupDTO dgDTO = new DetailGroupDTO();
                //       dgDTO.GroupID = GroupID;
                //       dgDTO.CustomerID = CustomerID;
                //       dgBUS.tblDetailGroup_insert(dgDTO);
                //       pnError.Visible = false;
                //       pnSuccess.Visible = true;
                //       lblSuccess.Text = "Bạn đã thêm thành công 1 khách hàng vào nhóm: " + drlGroup.SelectedItem.ToString();

                //       // Update limit send and create.
                //       updateLimitSendAndCreate(1, 0);
                //   }
                //}
                ConnectionData.CloseMyConnection();
                //setTextDefault();
            }
        }
        catch (Exception ex)
        {

            logs.Error(userLogin.Username + "-Client - btnAdd_Click", ex);
            pnError.Visible = true;
            lblError.Text = "Lỗi trong quá trình thêm khách hàng!" + ex.Message.ToString();
        }
    }
        public HttpResponseMessage Validate(CustomerDTO customerDTO)
        {
            try
            {
                if (customerDTO.parentId == null)
                {
                    customerDTO.parentId = 1;
                }

                var customer = _IOrgcustService.GetOrgcusts().Where(p => p.Org.Name == customerDTO.Name);
                if (customer.Count() <= 0)
                {
                    int userID = int.Parse(Request.Headers.GetValues("userId").FirstOrDefault());

                    var curDateTime = DateTime.UtcNow;

                    var guid = Guid.NewGuid();

                    Org newOrg = new Org {
                        Name           = customerDTO.Name,
                        Agreement      = customerDTO.Agreement,
                        ApprovedUserId = userID,
                        BillingInfo    = customerDTO.BillingInfo,
                        ApprovedDate   = DateTime.UtcNow,
                        Comments       = customerDTO.Comments,
                        CreateDate     = DateTime.UtcNow,
                        CreatedUserId  = userID,
                        Descript       = customerDTO.Descript,
                        GotAgreement   = customerDTO.GotAgreement,
                        ImageCleanUp   = customerDTO.ImageCleanUp,
                        ModifiedDate   = DateTime.UtcNow,
                        ModifiedUserId = userID,
                    };

                    newOrg.OrgOrgs.Add(new OrgOrg()
                    {
                        OrgId = customerDTO.parentId, AssociatedOrgId = newOrg.Id
                    });

                    OrgCust newCustomer = new OrgCust()
                    {
                        Org            = newOrg,
                        SubmissionOpts = customerDTO.SubmissionOpts,
                        RemoveBlank    = customerDTO.RemoveBlank
                    };

                    _IOrgcustService.AddOrgcust(newCustomer);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Customer Needs to be Unique"));
                }
            }
            catch (Exception e)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }


            return(Request.CreateResponse <bool>(HttpStatusCode.OK, true));
        }
 public VMEditCustomer(CustomerDTO current)
 {
     Customer = current;
     GetCountries();
 }
 public RequestCustomerSubscription(string tag, CustomerDTO customer) : base(tag)
 {
     this.customer = customer;
 }
    private void SetBankDetails(CustomerDTO customerDetails)
    {

        customerDetails.Cust_BankAccountNo = txtAccountNo.Text.Trim();
        customerDetails.Cust_BankIFCICode = txtICFAICode.Text.Trim();
        customerDetails.Cust_BankName = txtBankName.Text.Trim();
        customerDetails.Cust_BankBranch = txtBankBranch.Text.Trim();
        customerDetails.Cust_BankChequeNo = Convert.ToInt32(txtChequeNo.Text.Trim());
        customerDetails.Cust_AMEName = txtAMEName.Text.Trim();
        DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo;
        dateTimeFormatterProvider.ShortDatePattern = "dd/MM/yyyy";
        customerDetails.Cust_VATFiledON = DateTime.Parse(txtVatFiledOn.Text, dateTimeFormatterProvider);
        customerDetails.Cust_UnitStatus = Convert.ToInt32(ddlUnitStatus.SelectedItem.Value);
        customerDetails.Cust_BankAccountType = Convert.ToInt32(ddlAccountType.SelectedItem.Value);
    }
Beispiel #47
0
        public object Map()
        {
            var dto = new CustomerDTO();

            dto.Id = _customer.Id;
            dto.Name = _customer.Name;
            dto.AddressCity = _customer.Address.City;

            dto.Address = new Address() { Id = _customer.Address.Id, Street = _customer.Address.Street, Country = _customer.Address.Country, City = _customer.Address.City };

            dto.HomeAddress = new AddressDTO() { Id = _customer.HomeAddress.Id, Country = _customer.HomeAddress.Country, City = _customer.HomeAddress.City };

            dto.Addresses = new AddressDTO[_customer.Addresses.Length];
            for (int i = 0; i < _customer.Addresses.Length; i++)
            {
                dto.Addresses[i] = new AddressDTO() { Id = _customer.Addresses[i].Id, Country = _customer.Addresses[i].Country, City = _customer.Addresses[i].City };
            }

            dto.WorkAddresses = new List<AddressDTO>();
            foreach (var workAddress in _customer.WorkAddresses)
            {
                dto.WorkAddresses.Add(new AddressDTO() { Id = workAddress.Id, Country = workAddress.Country, City = workAddress.City });
            }

            return dto;
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ShowBlankScreen();

        CustomerDTO customerDetails = new CustomerDTO();
        customerDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(txtCustomerCode.Text.Trim());
        if (customerDetails.Cust_Id > 0)
        {
            if (customerDetails.Cust_IsVarified == false)
            {

                PopulateCustomerData(customerDetails.Cust_Id);
                SetAccountPanelVisiblity(true);
                btnCancel.Visible = false;
                btnClear.Visible = false;
                btnValidateSave.Visible = true;
                btnReset.Visible = true;
            }
            else
            {
                ucMessageBox.ShowMessage("Validation Process For This Customer Is Already Done"); 
            }
        }
        else
        { ucMessageBox.ShowMessage("Customer Details does not exit"); }


    }
    private void SetReportParametersForCustomers(CustomerDTO customerDTO, ReportViewer reportViewer)
    {
        ReportParameter Cust_TradeName = new ReportParameter("Cust_TradeName", customerDTO.Cust_TradeName);
        ReportParameter Cust_OwnerName = new ReportParameter("Cust_OwnerName", customerDTO.Cust_OwnerName);
        ReportParameter Cust_RegisteredAddress = new ReportParameter("Cust_RegisteredAddress", customerDTO.Cust_RegisteredAddress);
        ReportParameter Cust_UnitAddress = new ReportParameter("Cust_UnitAddress", customerDTO.Cust_UnitAddress);
        ReportParameter Cust_Pincode = new ReportParameter("Cust_Pincode", Convert.ToString(customerDTO.Cust_Pincode));
        ReportParameter Cust_State = new ReportParameter("Cust_State", customerDTO.Cust_State_Name);
        ReportParameter Cust_District = new ReportParameter("Cust_District", customerDTO.Cust_District_Name);
        ReportParameter Cust_Landmark = new ReportParameter("Cust_Landmark", customerDTO.Cust_Landmark);
        ReportParameter Cust_PhoneNo = new ReportParameter("Cust_PhoneNo", customerDTO.Cust_PhoneNo);
        ReportParameter Cust_MobileNo = new ReportParameter("Cust_MobileNo", customerDTO.Cust_MobileNo);
        ReportParameter Cust_OwnershipStatus = new ReportParameter("Cust_OwnershipStatus", Convert.ToString(customerDTO.Cust_OwnershipName));
        ReportParameter Cust_FatherName = new ReportParameter("Cust_FatherName", customerDTO.Cust_FathersName);
        ReportParameter Cust_AMEVisitDate = new ReportParameter("Cust_AMEVisitDate", Convert.ToDateTime(customerDTO.Cust_AMEVisitDate).ToString("dd MMM yyyy"));
        ReportParameter Cust_BusinessType = new ReportParameter("Cust_BusinessType", customerDTO.Cust_Business_Name);
        ReportParameter Cust_SalesType = new ReportParameter("Cust_SalesType", customerDTO.Cust_SalesType == 1 ? "Within Jharkhand" : "Outside Jharkhand");
        ReportParameter Cust_Post = new ReportParameter("Cust_Post", customerDTO.Cust_Post);
        ReportParameter Cust_NoOfChimneys = new ReportParameter("Cust_NoOfChimneys", Convert.ToString(customerDTO.Cust_NoOfChimneys));
        ReportParameter Cust_BrickCapacity = new ReportParameter("Cust_BrickCapacity", Convert.ToString(customerDTO.Cust_BrickCapacity));
        ReportParameter Cust_Excise_Range = new ReportParameter("Cust_Excise_Range", customerDTO.Cust_Excise_Range);
        ReportParameter Cust_Excise_Div = new ReportParameter("Cust_Excise_Div", customerDTO.Cust_Excise_Div);
        ReportParameter Cust_Excise_Comm = new ReportParameter("Cust_Excise_Comm", customerDTO.Cust_Excise_Comm);



        ReportParameter Cust_BankName = new ReportParameter("Cust_BankName", customerDTO.Cust_BankName);
        ReportParameter Cust_BankAccountType = new ReportParameter("Cust_BankAccountType", customerDTO.Cust_SalesType == 1 ? "Saving" : "Current");
        ReportParameter Cust_BankBranch = new ReportParameter("Cust_BankBranch", customerDTO.Cust_BankBranch);
        ReportParameter Cust_BankAccountNo = new ReportParameter("Cust_BankAccountNo", Convert.ToString(customerDTO.Cust_BankAccountNo));
        ReportParameter Cust_BankIFCICode = new ReportParameter("Cust_BankIFCICode", (customerDTO.Cust_BankIFCICode));
        ReportParameter Cust_BankChequeNo = new ReportParameter("Cust_BankChequeNo", Convert.ToString(customerDTO.Cust_BankChequeNo));
        ReportParameter Cust_AMEName = new ReportParameter("Cust_AMEName", customerDTO.Cust_AMEName);
        ReportParameter Cust_VATFiledON = new ReportParameter("Cust_VATFiledON", Convert.ToDateTime(customerDTO.Cust_VATFiledON).ToString("dd MMM yyyy"));
        ReportParameter Cust_UnitStatus = new ReportParameter("Cust_UnitStatus", customerDTO.Cust_UnitStatus == 1 ? "Working" : "Not Working");

        reportViewer.LocalReport.SetParameters(new ReportParameter[] {Cust_TradeName, Cust_OwnerName, Cust_RegisteredAddress,
             Cust_UnitAddress, Cust_Pincode, Cust_State, Cust_District, Cust_Landmark, Cust_PhoneNo, Cust_MobileNo, 
             Cust_OwnershipStatus, Cust_FatherName, Cust_AMEVisitDate, Cust_BusinessType, Cust_SalesType,
			 Cust_Post,Cust_NoOfChimneys,Cust_BrickCapacity,Cust_Excise_Range,Cust_Excise_Div,Cust_Excise_Comm,Cust_BankName,
             Cust_BankBranch,Cust_BankAccountNo,Cust_BankAccountType,Cust_BankIFCICode,Cust_BankChequeNo,Cust_AMEName,
             Cust_VATFiledON,Cust_UnitStatus  });
    }
Beispiel #50
0
 private void AddCustomerDTOToOrdersListViewModel(OrdersViewModel ordersListViewModel, CustomerDTO customerDTO)
 {
     // FEEDBACK: Again, you could use something like AutoMapper
     // to reduce this code down to a single method call.
     ordersListViewModel.Customer.IsValidCustomer = (customerDTO.CustomerId > 0);
     ordersListViewModel.Customer.CustomerId      = customerDTO.CustomerId;
     ordersListViewModel.Customer.FirstName       = customerDTO.FirstName;
     ordersListViewModel.Customer.LastName        = customerDTO.LastName;
     ordersListViewModel.Customer.Address         = customerDTO.Address;
     ordersListViewModel.Customer.City            = customerDTO.City;
     ordersListViewModel.Customer.StateCode       = customerDTO.StateCode;
     ordersListViewModel.Customer.PostalCode      = customerDTO.PostalCode;
 }
        /// <summary>
        /// Deletes the current selected customer.
        /// </summary>
        /// <param name="customer">The current customer to delete.</param>
        public void DeleteCustomers(CustomerDTO customer)
        {
            try
            {
                //remove customer
                var client = new ERPModuleServiceClient();

                client.RemoveCustomerCompleted += delegate(object o, AsyncCompletedEventArgs e)
                {
                    if (e.Error == null)
                    {
                        //refresh customer list
                        this.GetCustomers();
                    }
                    else if (e.Error is FaultException<ServiceError>)
                    {
                        var fault = e.Error as FaultException<ServiceError>;
                        MessageBox.Show(fault.Detail.ErrorMessage, "Error", MessageBoxButton.OK);
                    }
                    else
                    {
                        Debug.WriteLine("DeleteCustomers: Error at Service:" + e.Error.ToString());
                    }
                };

                client.RemoveCustomerAsync(customer.Id);
            }
            catch (FaultException<ServiceError> ex)
            {
                Debug.WriteLine("DeleteCustomers: Error at Service:" + ex.ToString());
            }
        }
Beispiel #52
0
 public RequestBurgerOrder(string tag, CustomerDTO customer, List <BurgerDTO> burgers) : base(tag)
 {
     this.burgers  = burgers;
     this.customer = customer;
 }
    protected string GetCustomerName(string custname)
    {
        CustomerDTO custDetails = new CustomerDTO();
        custDetails = ESalesUnityContainer.Container.Resolve<ICustomerService>().GetCustomerDetailsByCode(custname);

        if (custDetails.Cust_Id > 0)
        {
            return custDetails.Cust_FirmName;
        }
        else
        {
            return null;
        }
    }
 public void SaveCustomer(CustomerDTO customer) => CustomerService.Update(Util.Instance.Map <Customer>(customer));
 /// <summary>
 /// Initializes a new instance of the <see cref="VMEditCustomer"/> class.
 /// </summary>
 public VMEditCustomer()
 {
     _currentCustomer = new CustomerDTO();
     GetCountries();
 }
        public void CheckIfOrderWorksTest()
        {
            // Serwer
            WebSocketServer webSocketServer = new WebSocketServer();

            webSocketServer.Start("http://localhost:8080/BurgerTrack/");

            // Klient
            SystemController systemController = new SystemController();

            systemController.onProcess = new Action <string>(ReceiveMessage);

            Stopwatch timeoutStopwatch = new Stopwatch();

            timeoutStopwatch.Start();
            while (!systemController.webSocketController.webSocketClient.CheckConnectionStatus())
            {
                if (timeoutStopwatch.ElapsedMilliseconds > 15000.0f)
                {
                    throw new TimeoutException();
                }
            }

            systemController.RequestListOfBurgers();
            timeoutStopwatch.Restart();
            while (!gotResponse)
            {
                if (timeoutStopwatch.ElapsedMilliseconds > 15000.0f)
                {
                    throw new TimeoutException();
                }
            }
            gotResponse = false;
            CustomerDTO customerDTO = new CustomerDTO();

            customerDTO.name = "Kuba";

            BurgerDTO        Burger         = systemController.repository.GetListViewBurgers()[0];
            List <BurgerDTO> BurgersToOrder = new List <BurgerDTO>();

            BurgersToOrder.Add(Burger);
            systemController.RequestOrder(BurgersToOrder, customerDTO);
            timeoutStopwatch.Restart();
            while (!gotResponse)
            {
                if (timeoutStopwatch.ElapsedMilliseconds > 15000.0f)
                {
                    throw new TimeoutException();
                }
            }
            gotResponse = false;

            Assert.AreEqual(true, resultTest);

            customerDTO.name = "Merlin";
            systemController.RequestOrder(BurgersToOrder, customerDTO);
            timeoutStopwatch.Restart();
            while (!gotResponse)
            {
                if (timeoutStopwatch.ElapsedMilliseconds > 15000.0f)
                {
                    throw new TimeoutException();
                }
            }
            gotResponse = false;

            Assert.AreEqual(false, resultTest);
        }
Beispiel #57
0
 private void CreateDefault()
 {
    //create default customer information
    _currentCustomer = new CustomerDTO();
    CompanyName = "Company Name Here...";
 }
Beispiel #58
0
        private async Task InitializeOrder()
        {
            Order = await api.GetOrderById(Id);

            this.Date.Text = Order.CreateDate.ToString();
            decimal result   = 0;
            var     Currency = await api.GetCurrency();

            OrderStatus.Text    = Order.OrderStatus.ToString();
            ProductTile.Message = Order.ProductsList.First().Product.Price.ToString("0.0#") + " " + Currency;
            ProductTile.Title   = Order.ProductsList.First().Product.Name;
            ProductTile.Source  = (ImageSource)ConvertToBitmapImage(Order.ProductsList.First().Product.Image.First());
            var Products = new List <OrderDetailsProduct>();

            foreach (OrderItemDTO item in Order.ProductsList)
            {
                var toDecimal = (decimal)item.Quantity;
                result += item.Product.Price * toDecimal;
                Products.Add(new OrderDetailsProduct {
                    Product = item.Product.Name, Quantity = item.Quantity, Total = (item.Product.Price * toDecimal).ToString("0.0#"),
                    Image   = (ImageSource)ConvertToBitmapImage(item.Product.Image.First())
                });
            }

            ProductsList.ItemsSource = Products;

            Total.Text = result.ToString("0.0#") + " " + Currency;

            switch (Order.ShippingStatus)
            {
            case ShippingStatus.NotYetShipped:
                ShippingStatusDetails.Text = "Not Yet Shipped";
                break;

            case ShippingStatus.PartiallyShipped:
                ShippingStatusDetails.Text = "Partially Shipped";
                break;

            case ShippingStatus.ShippingNotRequired:
                ShippingStatusDetails.Text = "Shipping Not Required";
                break;

            default:
                ShippingStatusDetails.Text = Order.ShippingStatus.ToString();
                break;
            }
            switch (Order.PayStatus)
            {
            case PaymentStatus.PartiallyRefunded:
                PaymentStatusDetails.Text = "Partially Refunded";
                break;

            default:
                PaymentStatusDetails.Text = Order.PayStatus.ToString();
                break;
            }

            var CustomerTask = await api.GetCustomersByEmail(Order.OrderEmail);

            Customer = CustomerTask.First();

            Email.Text   = Customer.Email;
            Name.Text    = Customer.FullName;
            Address.Text = Order.Address;
            if (Customer.Phone == null)
            {
                Phone.Text = "Not Available";
            }
            else
            {
                Phone.Text = Customer.Phone;
            }
        }
    private CustomerDTO InitializeCustomerDetails()
    {
        CustomerDTO customerDetails = new CustomerDTO();

        if (ViewState[Globals.StateMgmtVariables.CUSTOMERID] != null)
        {
            int customerId = Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID]);
            
            customerDetails = MasterList.GetCustomerDetailsById(customerId);
            ViewState[Globals.StateMgmtVariables.EDITCUSTOMER] = true;
        }

        customerDetails.Cust_TradeName = txtTradeName.Text.Trim();
        customerDetails.Cust_FirmName = txtFirmName.Text.Trim();
        customerDetails.Cust_OwnerName = txtOwnerName.Text.Trim();
        customerDetails.Cust_FathersName = txtFatherName.Text.Trim();
        customerDetails.Cust_UnitAddress = txtUnitAddress.Text.Trim(); ;
        customerDetails.Cust_Post = txtPost.Text.Trim();
        customerDetails.Cust_RegisteredAddress = txtRegAddress.Text.Trim();
        customerDetails.Cust_State = Convert.ToInt32(ddlState.SelectedItem.Value);
        customerDetails.Cust_District = Convert.ToInt32(ddlDist.SelectedItem.Value);
        customerDetails.Cust_Landmark = txtLandMark.Text.Trim();
        customerDetails.Cust_Pincode = Convert.ToInt32(txtPincode.Text);
        customerDetails.Cust_MobileNo = txtMobile.Text.Trim();
        customerDetails.Cust_PhoneNo = txtPhoneNo.Text.Trim();
        customerDetails.Cust_OwnershipStatus = Convert.ToInt32(ddlOwnershipStatus.SelectedItem.Value);
        customerDetails.Cust_BusinessType = Convert.ToInt32(ddlBusinessType.SelectedItem.Value);
        customerDetails.Cust_SalesType = Convert.ToInt32(ddlSaleType.SelectedItem.Value);
        customerDetails.Cust_PartnerPhoneNo = txtPartnerMobile.Text.Trim();
        customerDetails.Cust_AMEBlockId = Convert.ToInt32(ddlAME.SelectedItem.Value);
        customerDetails.Cust_NoOfChimneys = Convert.ToInt32(txtNoOfChimney.Text);
        customerDetails.Cust_BrickCapacity = Convert.ToInt32(txtBrickCapacity.Text);
        customerDetails.Cust_Excise_Range = txtExciseRange.Text.Trim();
        customerDetails.Cust_Excise_Div = txtExciseDiv.Text.Trim();
        customerDetails.Cust_Excise_Comm = txtExciseComm.Text.Trim();
        customerDetails.Cust_CreatedBy = GetCurrentUserId();
        customerDetails.Cust_FolderName = Convert.ToString(ViewState[Globals.StateMgmtVariables.CUSTFOLDERNAME]);
        customerDetails.Cust_RegCustType = ViewState[Globals.StateMgmtVariables.CUSTOMEREGTYPE] != null ? Convert.ToBoolean(customerDetails.Cust_RegCustType) : true;

        if (customerDetails.Cust_Id > 0)
        {
            customerDetails.Cust_LastUpdatedDate = DateTime.Now;
        }
        else
        {
            customerDetails.Cust_CreatedDate = DateTime.Now;
        }

        DateTimeFormatInfo dateTimeFormatterProvider = DateTimeFormatInfo.CurrentInfo.Clone() as DateTimeFormatInfo;
        dateTimeFormatterProvider.ShortDatePattern = "dd/MM/yyyy";
        customerDetails.Cust_AMEVisitDate = DateTime.Parse(txtAMEVisitDate.Text, dateTimeFormatterProvider);
        return customerDetails;
    }
Beispiel #60
0
 public void Create(CustomerDTO customer)
 {
     _logic.Create(customer);
 }