Esempio n. 1
0
        public string AddEmployeeDetails(string empName, string email, string phoneNumber, string password, string company, string companySize, string profilePhoto)
        {
            empDetails = new EmployeeDetails();
            string passwordHashSalt = string.Empty;
            int    empId            = 0;

            try
            {
                #region Password Encryption
                passwordHashSalt = PasswordHash.CreateHash(password);
                string[] passwordValues = passwordHashSalt.Split(':');
                #endregion
                var PhotoBase64 = System.Convert.FromBase64String(profilePhoto);
                empDetails.Emp_Name     = empName;
                empDetails.Emp_Role     = 2;
                empDetails.Email        = email;
                empDetails.PasswordSalt = password; //Convert.ToString(passwordValues[1]).Trim();
                empDetails.PasswordHash = Convert.ToString(passwordValues[2]).Trim();
                empDetails.PhoneNumber  = phoneNumber;
                empDetails.Gender       = "";
                empDetails.DOB          = "";
                empDetails.ProfilePhoto = PhotoBase64;
                empDetails.Company_Name = Convert.ToString(Session["CompanyName"]);
                empDetails.Address      = "";
                empDetails.Country_ID   = 1;
                empDetails.PostalCode   = "";
                empDetails.Created_By   = Convert.ToString(Session["EmpName"]);
                responseMsg             = repository.AddNewEmpDetails(empDetails);
                string[] response = responseMsg.Split(',');
                if (response.Length == 2)
                {
                    responseMsg = Convert.ToString(response[0]);
                }
                else
                {
                    responseMsg = "Fail";
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
                var    frame          = trace.FrameCount > 1 ? trace.GetFrame(1) : trace.GetFrame(0);
                int    Line           = (int)frame.GetFileLineNumber();
                string methodName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                LogClass.CreateLogXml(ex.Message, controllerName, Convert.ToString(ex.InnerException), methodName, Line);
            }

            return(responseMsg);
        }
Esempio n. 2
0
        public string CreditCardAndBillingDetails(string cardHolderName, int cardType, string cardNumber, int CVV, int cardExpMonth, int cardExpYear,
                                                  string Name, string address, int country, string postalCode, string phoneNumber, string email)
        {
            empDetails  = new EmployeeDetails();
            ccDetails   = new CreditCardDetails();
            repository  = new ICONHRRepository();
            responseMsg = string.Empty;
            int empId = 0;

            try
            {
                //Employee details
                empDetails            = (EmployeeDetails)Session["EmployeeModel"];
                empDetails.Country_ID = Convert.ToInt32(country);
                responseMsg           = repository.AddNewEmpDetails(empDetails);

                string[] arrResponse = responseMsg.Split(',');
                if (response.Length > 1)
                {
                    responseMsg = Convert.ToString(arrResponse[0]);
                    empId       = Convert.ToInt32(arrResponse[1]);
                    if (empId != 0)
                    {
                        // Card Card details
                        repository                  = new ICONHRRepository();
                        ccDetails.Emp_ID            = empId;
                        ccDetails.CardHolder        = cardHolderName;
                        ccDetails.CardTypeID        = cardType;
                        ccDetails.CardNumber        = cardNumber;
                        ccDetails.CVV               = CVV;
                        ccDetails.Card_Exp_Month_ID = cardExpMonth;
                        ccDetails.Card_Exp_Year_ID  = cardExpYear;

                        // Billing details
                        ccDetails.Name               = Name;
                        ccDetails.Address            = address;
                        ccDetails.Country_ID         = country;
                        ccDetails.PostalCode         = postalCode;
                        ccDetails.BillingEmail       = email;
                        ccDetails.BillingPhoneNumber = phoneNumber;
                        ccDetails.Created_By         = empDetails.Created_By;

                        responseMsg = repository.AddCreditCardDetails(ccDetails);

                        if (responseMsg == response)
                        {
                            Session["EmployeeModel"] = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
                var    frame          = trace.FrameCount > 1 ? trace.GetFrame(1) : trace.GetFrame(0);
                int    Line           = (int)frame.GetFileLineNumber();
                string methodName     = this.ControllerContext.RouteData.Values["action"].ToString();
                string controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                LogClass.CreateLogXml(ex.Message, controllerName, Convert.ToString(ex.InnerException), methodName, Line);
            }

            return(responseMsg);
        }