Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];
            long   serId;

            if (string.IsNullOrEmpty(id) || !long.TryParse(id, out serId))
            {
                Response.Close();
                return;
            }
            service = bll.GetService(serId);
            if (service.object_type == 1)
            {
                var ser = new ServiceBLL().GetServiceById(service.object_id);
                serviceName = ser.name;
                description = ser.invoice_description;
            }
            else
            {
                var ser = new ServiceBLL().GetServiceBundleById(service.object_id);
                serviceName = ser.name;
                description = ser.invoice_description;
            }

            if (IsPostBack)
            {
                var ser = AssembleModel <ctt_contract_service>();
                bll.EditServiceInvoiceDescription(ser, GetLoginUserId());
                Response.Write("<script>alert('修改发票描述成功!');window.close();self.opener.location.reload();</script>");
            }
        }
        public NormasController(ILogger <NormasController> logger, IConfiguration configuration) : base(logger)
        {
            string conString = ConfigurationExtensions
                               .GetConnectionString(configuration, "TCLEGISConnectionString");

            _serviceBLL = new ServiceBLL(conString);
        }
Example #3
0
 public UnitOfWork(IDbConnection connection)
 {
     Message  = new MessageBLL(connection);
     News     = new NewsBLL(connection);
     Services = new ServiceBLL(connection);
     Projects = new ProjectBLL(connection);
 }
Example #4
0
        public IActionResult LoginUser(User users)
        {
            UsersBLL bll = new UsersBLL();

            users.Password = Encryption.Encrypt(users.Password, "asdfewrewqrss323");
            User user = bll.LoginUser(users.Email, users.Password);

            if (user != null)
            {
                if (user.IsActive == true)
                {
                    string     Token          = Common.JwtHelper.CreateToken(user);
                    ServiceBLL sbl            = new ServiceBLL();
                    var        allowedService = sbl.UserServices(user.Id);
                    string     baseURL        = $"{this.Request.Scheme}://{this.Request.Host}{this.Request.PathBase}";
                    // bll.UpdateUser(user);
                    return(Ok(new { token = Token, service = allowedService, BaseURI = baseURL }));
                }
                else
                {
                    return(BadRequest("notactive"));
                }
            }
            else
            {
                return(BadRequest("nofound"));
            }
        }
        protected void DeleteFile(object sender, EventArgs e)
        {
            string employeeID = Convert.ToString(txtEid_LV.Text);
            Int64  EMP_ID     = Convert.ToInt64(lblHiddenId.Text);
            //string rootPath = Server.MapPath("../HRM/File/");
            //string filePath = (sender as LinkButton).CommandArgument;
            //string fullPath = rootPath + filePath;

            //File.Delete(fullPath);
            //Response.Redirect(Request.Url.AbsoluteUri);


            ServiceBLL  sv     = new ServiceBLL();
            LinkButton  imgbtn = (LinkButton)sender;
            GridViewRow row    = (GridViewRow)imgbtn.NamingContainer;

            try
            {
                string FilePath  = "";
                Label  lblfileID = (Label)grd_File.Rows[row.RowIndex].FindControl("lblfileID");
                if (lblfileID != null)
                {
                    FilePath = lblfileID.Text;
                    int result = sv.FilePathDEleting(FilePath);
                    if (result == 1)
                    {
                        BindGridEmployee(employeeID);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        public IHttpActionResult Get(string externalReference)
        {
            try
            {
                ServiceBLL serviceBLL  = new ServiceBLL();
                UserBLL    userBLL     = new UserBLL();
                var        contractBLL = new ContractBLL();
                if (string.IsNullOrEmpty(externalReference))
                {
                    throw new Exception();
                }

                //var paymentInfo = await Task.Run(() => Payment.FindById(long.Parse(id)));

                //var extRef = paymentInfo.ExternalReference;
                //var status = paymentInfo.Status;
                var user = userBLL.GetById(Guid.Parse(externalReference.Split('/')[0]));

                if (user.Contract == null && user.Permissions.Where(p => p.Name != "Login").ToList().Count > 0)
                {
                    throw new BusinessException(Messages.ErrorContractUser);
                }

                if (user.Contract != null && user.Contract.Service.Id == Guid.Parse(externalReference.Split('/')[1]))
                {
                    if (user.Contract.ExpirationDate > DateTime.Now)
                    {
                        throw new BusinessException(Messages.ErrorContractExists);
                    }
                }


                ContractViewModel cvm = new ContractViewModel()
                {
                    User = user,

                    Service = serviceBLL.GetById(Guid.Parse(externalReference.Split('/')[1]))
                };

                user.Contract = cvm;


                if (!userBLL.Update(user))
                {
                    throw new BusinessException(Messages.ErrorContract);
                }


                var response = Request.CreateResponse(System.Net.HttpStatusCode.OK, Messages.SuccessfulContract);

                return(this.ResponseMessage(response));
            }
            catch (Exception ex)
            {
                var response = Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError, Messages.Generic_Error);
                return(this.ResponseMessage(response));
            }
        }
Example #7
0
        private void LoadData()
        {
            ServiceEntity oService = (ServiceEntity)ServiceBLL.GetService(Convert.ToInt32(hdnServiceID.Value));

            //ddlFromLocation.SelectedIndex = Convert.ToInt32(ddlFromLocation.Items.IndexOf(ddlFromLocation.Items.FindByValue(oImportHaulage.LocationFrom)));
            hdnFPOD.Value             = oService.FPODID.ToString();
            ddlLine.SelectedValue     = oService.LinerID.ToString();
            ddlServices.SelectedValue = oService.ServiceNameID.ToString();
            //txtService.Text = Convert.ToString(oService.ServiceName);
            txtFPOD.Text       = Convert.ToString(oService.FPOD);
            hdnServiceID.Value = Convert.ToString(oService.ServiceID);
        }
 //[Authorize]
 public async Task <IActionResult> UpdateService(Service _service)
 {
     try
     {
         ServiceBLL ser = new ServiceBLL();
         ser.AddService(_service);
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e));
     }
 }
Example #9
0
        public void SplitLine_PassLine_GetSplitedItems()
        {
            // arrange
            string stringToTransform = "this,should,be,splitted";
            var    serviceBLL        = new ServiceBLL();

            string[] expected = new string[] { "this", "should", "be", "splitted" };

            // act
            string[] actual = serviceBLL.SplitLine(stringToTransform);

            // assert
            Assert.AreEqual(expected, actual);
        }
Example #10
0
        public AdminController()
        {
            _ClientBll   = new ClientBLL();
            _carBll      = new CarBLL();
            _contractBll = new ContractBLL();
            _employeeBll = new EmployeeBLL();
            _serviceBll  = new ServiceBLL();

            ViewData["Clients"]   = _clients;
            ViewData["Cars"]      = _cars;
            ViewData["Contracts"] = _contracts;
            ViewData["Employees"] = _employees;
            ViewData["Services"]  = _services;
        }
Example #11
0
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.pid.Text))
            {
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    pid.Background = Brushes.Red;
                }
                MessageBox.Show("Validate");
                return;
            }
            ServiceForUpdateBO item = new ServiceForUpdateBO();

            item.Pid = this.pid.Text;

            ServiceBLL salebl = new ServiceBLL();

            item = salebl.searchToUpdateItem(item);

            if (item == null)
            {
                MessageBox.Show("Product is not Serviced");
                this.pid.Text = null;

                this.pid.IsEnabled = true;
                //this.quantity.Text = null;
            }
            else
            {
                this.pid.Text            = item.Pid;
                this.price.Text          = item.Price.ToString();
                this.category.Text       = item.Category;
                this.size.Text           = item.Size.ToString();
                this.color.Text          = item.Color;
                this.brand.Text          = item.Brand;
                this.entryDate.Text      = item.Date;
                this.address.Text        = item.Address;
                this.customerName.Text   = item.CustomerName;
                this.phone.Text          = item.Phone;
                this.serviceCharges.Text = item.Charges.ToString();
                this.entryDate.Text      = item.Date;
                this.serviceDate.Text    = item.ServiceDate;
                this.returnDate.Text     = item.ReturnDate;
                //this.quantity.Text = item.Quantity.ToString();
                this.pid.IsEnabled = false;
            }
        }
Example #12
0
        /// <summary>
        /// 获取服务/服务包信息
        /// </summary>
        /// <param name="context"></param>
        private void GetService(HttpContext context)
        {
            var bll  = new ServiceBLL();
            var id   = context.Request.QueryString["id"];
            var type = context.Request.QueryString["type"];

            if ("2".Equals(type))
            {
                var serviceBundle = bll.GetServiceBundleById(long.Parse(id));
                context.Response.Write(new Tools.Serialize().SerializeJson(serviceBundle));
            }
            else
            {
                var service = bll.GetServiceById(long.Parse(id));
                context.Response.Write(new Tools.Serialize().SerializeJson(service));
            }
        }
Example #13
0
        /// <summary>
        /// 删除服务/服务包
        /// </summary>
        public void DeleteService(HttpContext context)
        {
            var result      = true;
            var faileReason = "";
            var serId       = context.Request.QueryString["service_id"];

            if (!string.IsNullOrEmpty(serId))
            {
                if (!string.IsNullOrEmpty(context.Request.QueryString["is_bundle"]))
                {
                    result = new ServiceBLL().DeleteServiceBundle(long.Parse(serId), LoginUserId, ref faileReason);
                }
                else
                {
                    result = new ServiceBLL().DeleteService(long.Parse(serId), LoginUserId, ref faileReason);
                }
            }
            context.Response.Write(new EMT.Tools.Serialize().SerializeJson(new { result = result, reason = faileReason }));
        }
Example #14
0
        private void search_btn_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(this.pid.Text))
            {
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    pid.Background = Brushes.Red;
                }
                MessageBox.Show("Validate");
                return;
            }
            ItemBO item = new ItemBO();

            item.Pid = this.pid.Text;
            ServiceBLL salebl = new ServiceBLL();

            item = salebl.searchItem(item);

            if (item == null)
            {
                MessageBox.Show("Product is not Sold");
                this.pid.Text       = null;
                this.price.Text     = null;
                this.category.Text  = null;
                this.size.Text      = null;
                this.color.Text     = null;
                this.brand.Text     = null;
                this.entryDate.Text = null;
                //this.quantity.Text = null;
            }
            else
            {
                this.pid.Text       = item.Pid;
                this.price.Text     = item.Price.ToString();
                this.category.Text  = item.Category;
                this.size.Text      = item.Size.ToString();
                this.color.Text     = item.Color;
                this.brand.Text     = item.Brand;
                this.entryDate.Text = item.Date;
                //this.quantity.Text = item.Quantity.ToString();
                this.pid.IsEnabled = false;
            }
        }
        private void LoadService()
        {
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    CommonBLL commonBll = new CommonBLL();

                    gvwService.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwService.PageSize = searchCriteria.PageSize;
                    }

                    gvwService.DataSource = ServiceBLL.GetService(searchCriteria, 0);
                    gvwService.DataBind();
                }
            }
        }
Example #16
0
 public ServiceController()
 {
     this.serviceBLL = new ServiceBLL();
 }
        public IEnumerable <UserServicesVM> userServices(int ID = 0)
        {
            ServiceBLL serbll = new ServiceBLL();

            return(serbll.userServices(ID));
        }
        public IEnumerable <Service> notAssignService(int ID = 0)
        {
            ServiceBLL serbll = new ServiceBLL();

            return(serbll.notAssignServices(ID));
        }
Example #19
0
        private void addService_btn_Click(object sender, RoutedEventArgs e)
        {
            int  n;
            bool isNumeric = int.TryParse(this.price.Text, out n);
            int  n2;
            bool isNumeric2 = int.TryParse(this.size.Text, out n2);

            if (string.IsNullOrWhiteSpace(this.pid.Text))
            {
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    pid.Background = Brushes.Red;
                }
                MessageBox.Show("Validate");
                return;
            }
            if ((isNumeric == false) || string.IsNullOrWhiteSpace(this.category.Text) || (isNumeric2 == false) || string.IsNullOrWhiteSpace(this.color.Text) || string.IsNullOrWhiteSpace(this.brand.Text) || string.IsNullOrWhiteSpace(this.entryDate.Text))
            {
                search_btn_Click(sender, e);
                if (string.IsNullOrWhiteSpace(this.pid.Text))
                {
                    return;
                }
            }
            int  n3;
            bool isNumeric3 = int.TryParse(this.serviceCharges.Text, out n3);

            if ((isNumeric3 == false) || string.IsNullOrWhiteSpace(this.customerName.Text) || string.IsNullOrWhiteSpace(this.address.Text) || string.IsNullOrWhiteSpace(this.phone.Text))
            {
                if ((isNumeric3 == false))
                {
                    serviceCharges.Background = Brushes.Red;
                }
                if (string.IsNullOrWhiteSpace(this.customerName.Text))
                {
                    customerName.Background = Brushes.Red;
                }
                if (string.IsNullOrWhiteSpace(this.address.Text))
                {
                    address.Background = Brushes.Red;
                }
                if (string.IsNullOrWhiteSpace(this.phone.Text))
                {
                    phone.Background = Brushes.Red;
                }
                return;
            }
            ServiceBO item = new ServiceBO();

            item.Pid          = this.pid.Text;
            item.Charges      = Convert.ToInt32(this.serviceCharges.Text);
            item.CustomerName = this.customerName.Text;
            item.Address      = this.address.Text;
            item.Phone        = this.phone.Text;
            item.ServiceDate  = this.serviceDate.Text;
            item.ReturnDate   = this.returnDate.Text;

            //MessageBox.Show(item.Pid + " " + item.Price + " " + item.Category + " " + item.Size + " " + item.Color + " " + item.Brand + " " + item.Date);

            ServiceBLL itenbl = new ServiceBLL();
            int        rv     = itenbl.addService(item);

            if (rv == 0)
            {
                MessageBox.Show("Service Added");
                this.pid.Text      = null;
                this.price.Text    = null;
                this.pid.IsEnabled = true;

                //this.quantity.Text = null;
            }
            else if (rv == 3)
            {
                MessageBox.Show("Product ID Already Exist");
                this.pid.Text      = null;
                this.pid.IsEnabled = true;
            }
            else
            {
                MessageBox.Show("Error");
                this.pid.IsEnabled = true;
            }
        }
Example #20
0
 public void SetupBeforeEachTest()
 {
     serviceBLL = new ServiceBLL();
 }
        public IEnumerable <Service> ServicesList()
        {
            ServiceBLL serbll = new ServiceBLL();

            return(serbll.ServicesList());
        }
Example #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                //if (Convert.ToDecimal(txtWFrom.Text) > Convert.ToDecimal(txtWTo.Text))
                //{
                //    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00077") + "');</script>", false);
                //    return;
                //}

                oServiceBll    = new ServiceBLL();
                oServiceEntity = new ServiceEntity();
                //oUserEntity = (UserEntity)Session[Constants.SESSION_USER_INFO]; // This section has been commented temporarily

                oServiceEntity.LinerID = ddlLine.SelectedValue.ToInt();

                oServiceEntity.FPODID        = hdnFPOD.Value;
                oServiceEntity.ServiceNameID = ddlServices.SelectedValue.ToInt();
                //oServiceEntity.ServiceName = Convert.ToString(txtService.Text.Trim());

                if (hdnServiceID.Value == "0")           // Insert
                {
                    oServiceEntity.CreatedBy  = _userId; // oUserEntity.Id;
                    oServiceEntity.CreatedOn  = DateTime.Today.Date;
                    oServiceEntity.ModifiedBy = _userId; // oUserEntity.Id;
                    oServiceEntity.ModifiedOn = DateTime.Today.Date;

                    switch (oServiceBll.AddEditService(oServiceEntity, _CompanyId))
                    {
                    case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076");
                        break;

                    case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                        ClearAll();
                        break;

                    case 1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00009");
                        ClearAll();
                        break;
                    }
                }
                else // Update
                {
                    oServiceEntity.ServiceID  = Convert.ToInt32(hdnServiceID.Value);
                    oServiceEntity.ModifiedBy = _userId;// oUserEntity.Id;
                    oServiceEntity.ModifiedOn = DateTime.Today.Date;
                    oServiceEntity.Action     = true;
                    //
                    switch (oServiceBll.AddEditService(oServiceEntity, _CompanyId))
                    {
                    case -1: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00076");
                        break;

                    case 0: lblMessage.Text = ResourceManager.GetStringWithoutName("ERR00011");
                        break;

                    case 1: Response.Redirect("~/MasterModule/ManageService.aspx");
                        break;
                    }
                }
            }
        }
 private void DeleteService(int locId)
 {
     ServiceBLL.DeleteService(locId);
     LoadService();
     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00010") + "');</script>", false);
 }