Esempio n. 1
0
        /// <summary>
        /// Get Pending/Approve status
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="customerId">customerId</param>
        /// <returns>return status</returns>
        public int GetCheckBookBorrowStatus(int bookId, int customerId)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetCheckBookBorrowStatus(bookId, customerId);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Return Book
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="userId">userId</param>
        /// <param name="borrowId">borrowId</param>
        /// <param name="returnNotes">returnNotes</param>
        /// <param name="returnDate">returnDate</param>
        /// <returns>return status</returns>
        public int BookReturn(int bookId, int userId, int borrowId, string returnNotes, DateTime returnDate)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.BookReturn(bookId, userId, borrowId, returnNotes, returnDate);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Check Book Pending Entry
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="customerId">customerId</param>
        /// <returns>return status</returns>
        public bool CheckBookPendingEntry(int bookId, int customerId)
        {
            bool retVal = false;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.CheckBookPendingEntry(bookId, customerId);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToBoolean(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Get Current Book Status
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="active">active</param>
        /// <returns>Get Book Status</returns>
        public int GetCurrentBookStatus(int bookId, int?active)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetCurrentBookStatus(bookId, active);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Accept Cancel Book Borrow Request
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="userId">userId</param>
        /// <param name="statusId">statusId</param>
        /// <param name="borrowId">borrowId</param>
        /// <param name="bookperiod">bookperiod</param>
        /// <returns>return status</returns>
        public int AcceptCancelBookBorrowRequest(int bookId, int userId, int statusId, int borrowId, int bookperiod)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.AcceptCancelBookBorrowRequest(bookId, userId, statusId, borrowId, bookperiod);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Get Book Details Complete
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="customerId">Customer Id</param>
        /// <returns>Book Details</returns>
        public Book GetBookDetailsComplete(int bookId, int?customerId = null)
        {
            Book retVal = new Book();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetBookDetailsComplete(bookId, customerId);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.DataTableIntoList <Book>(ds.Tables[0]).FirstOrDefault();
                    }
                }

                return(retVal);
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Get Space Details Complete
        /// </summary>
        /// <param name="customerId">customerId</param>
        /// <param name="searchText">searchText</param>
        /// <param name="startRowIndex">startRowIndex</param>
        /// <param name="endRowIndex">endRowIndex</param>
        /// <param name="sortExpression">Sort Expression</param>
        /// <param name="sortDirection">Sort Direction</param>
        /// <returns>Space Details</returns>
        public List <SpaceBooking> GetSpaceDetailsOfCustomer(int customerId, string searchText, int?startRowIndex, int?endRowIndex, string sortExpression, string sortDirection)
        {
            List <SpaceBooking> retVal = new List <SpaceBooking>();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetSpaceDetailsOfCustomer(customerId, searchText, startRowIndex, endRowIndex, sortExpression, sortDirection);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.DataTableIntoList <SpaceBooking>(ds.Tables[0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Get Book Borrowed Details
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="statusId">statusId</param>
        /// <param name="active">active</param>
        /// <param name="startRowIndex">startRowIndex</param>
        /// <param name="endRowIndex">endRowIndex</param>
        /// <param name="sortExpression">sortExpression</param>
        /// <param name="sortDirection">sortDirection</param>
        /// <param name="searchText">searchText</param>
        /// <returns> Book Borrowed Details</returns>
        public List <BorrowedBook> GetBookBorrowedDetails(int bookId, int?statusId = null, int?active = 1, int?startRowIndex = null, int?endRowIndex = null, string sortExpression = null, string sortDirection = null, string searchText = null)
        {
            List <BorrowedBook> retVal = new List <BorrowedBook>();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetBookBorrowedDetails(bookId, statusId, active, startRowIndex, endRowIndex, sortExpression, sortDirection, searchText);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.DataTableIntoList <BorrowedBook>(ds.Tables[0]).ToList();
                    }
                }

                return(retVal);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Delete PageAccess based on role
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>Delete PageAccess</returns>
        public int DeletePageAccessBasedOnRole(int id)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.DeletePageAccessBasedOnUserRole(id);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0]);
                    }
                }
            }

            return(retVal);
        }
Esempio n. 10
0
        /// <summary>
        /// Get page access list
        /// </summary>
        /// <param name="roleId">roleId</param>
        /// <returns> return list of page access</returns>
        public object GetPageAccessBasedOnUserRole(int?roleId)
        {
            List <PageAccess> pageAccessesList = new List <PageAccess>();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetPageAccessBasedOnUserRole(roleId);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        pageAccessesList = ConvertTo.DataTableIntoList <PageAccess>(ds.Tables[0]).ToList();
                    }
                }
            }

            return((object)pageAccessesList);
        }
Esempio n. 11
0
        protected override List <ForeignKeyInfo> GetForeignKeys(DataConnection dataConnection)
        {
            var data = ((OleDbConnection)Proxy.GetUnderlyingObject((DbConnection)dataConnection.Connection))
                       .GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys, new object[] { null, null });

            var q = from fk in data.AsEnumerable()
                    select new ForeignKeyInfo
            {
                Name         = fk.Field <string>("FK_NAME"),
                ThisColumn   = fk.Field <string>("FK_COLUMN_NAME"),
                OtherColumn  = fk.Field <string>("PK_COLUMN_NAME"),
                ThisTableID  = fk.Field <string>("FK_TABLE_CATALOG") + "." + fk.Field <string>("FK_TABLE_SCHEMA") + "." + fk.Field <string>("FK_TABLE_NAME"),
                OtherTableID = fk.Field <string>("PK_TABLE_CATALOG") + "." + fk.Field <string>("PK_TABLE_SCHEMA") + "." + fk.Field <string>("PK_TABLE_NAME"),
                Ordinal      = ConvertTo <int> .From(fk.Field <long>("ORDINAL")),
            };

            return(q.ToList());
        }
Esempio n. 12
0
        /// <summary>
        /// Get book comments
        /// </summary>
        /// <param name="bookId">bookId</param>
        /// <param name="searchText">searchText</param>
        /// <param name="startRowIndex">startRowIndex</param>
        /// <param name="endRowIndex">endRowIndex</param>
        /// <param name="sortExpression">sortExpression</param>
        /// <param name="sortDirection">sortDirection</param>
        /// <returns> return book comments</returns>
        public List <BookDiscussion> GetBookComments(int bookId, string searchText, int?startRowIndex, int?endRowIndex, string sortExpression, string sortDirection)
        {
            List <BookDiscussion> retVal = new List <BookDiscussion>();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.GetBookDiscussions(bookId, searchText, startRowIndex, endRowIndex, sortExpression, sortDirection);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        retVal = ConvertTo.DataTableIntoList <BookDiscussion>(ds.Tables[0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Login method
        /// </summary>
        /// <param name="model">model</param>
        /// <returns> return login response</returns>
        public Login GetUserLogin(Login model)
        {
            Login respModel = new Login();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.UserLogin(model.Email, model.Password);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        respModel.Userdata = ConvertTo.DataTableIntoList <User>(ds.Tables[0]).ToList().FirstOrDefault();
                    }
                }
            }

            return(respModel);
        }
Esempio n. 14
0
        public void EnumValue()
        {
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From(Enum2.Value1));
            Assert.AreEqual(Enum2.Value2, ConvertTo <Enum2> .From(Enum3.Value2));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From(1));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From((int?)1));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2?> .From((int?)1));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2?> .From(1));
            Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3> .From(1.0));
            Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3?> .From(1.0));
            Assert.AreEqual(Enum3.Value1, ConvertTo <Enum3?> .From((double?)1.0));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("1"));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("+1"));

            Assert.AreEqual("Value1", ConvertTo <string> .From(Enum2.Value1));
            Assert.AreEqual(Enum2.Value1, ConvertTo <Enum2> .From("Value1"));
            Assert.AreEqual(Enum2.Value2, ConvertTo <Enum2> .From("value2"));
        }
Esempio n. 15
0
        public void IsDbGeneratedTest([IncludeDataSources(TestProvName.AllSQLite)] string context)
        {
            ResetPersonIdentity(context);

            using (var db = GetDataContext(context))
            {
                db.BeginTransaction();

                var id = db.InsertWithIdentity(new L2SPersons
                {
                    FirstName = "Test",
                    LastName  = "Test",
                    Gender    = "M"
                });

                db.GetTable <L2SPersons>().Delete(p => p.PersonID == ConvertTo <int> .From(id));
            }
        }
        public ActionResult Manage(string id = "MA==")
        {
            if (TempData["openPopup"] != null)
            {
                ViewBag.openPopup = TempData["openPopup"];
            }
            int Id = Convert.ToInt32(ConvertTo.Base64Decode(id));

            ViewBag.User          = BindUserDropdown();
            ViewBag.Opportunities = BindOpportunitiesDropdown();
            ViewBag.Status        = BindStatusDropdown();
            if (Id > 0)
            {
                var model = abstractOpportunities_TasksServices.Opportunities_TasksSelectById(Id).Item;
                return(View(model));
            }
            return(View());
        }
Esempio n. 17
0
        /// <summary>
        /// Login method
        /// </summary>
        /// <param name="userEmail">Email Id</param>
        /// <returns> return login response</returns>
        public Login GetCustomerLoginwithEmail(string userEmail)
        {
            Login respModel = new Login();

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.CustomerLoginwithEmail(userEmail);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables[0]?.Rows.Count > 0)
                    {
                        respModel.Customerdata = ConvertTo.DataTableIntoList <Customer>(ds.Tables[0]).ToList().FirstOrDefault();
                    }
                }
            }

            return(respModel);
        }
Esempio n. 18
0
        /// <summary>
        /// Scheduler Run for All Pending Requests
        /// </summary>
        /// <param name="schedulerDate">schedulerDate</param>
        /// <returns>return Status</returns>
        public int SchedulerRunforAllPendingRequests(DateTime schedulerDate)
        {
            int retVal = 0;

            using (CustomContext service = new CustomContext())
            {
                DataSet ds = service.SchedulerRunforAllPendingRequests(schedulerDate);
                if (ds?.Tables.Count > 0)
                {
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        retVal = ConvertTo.ToInteger(ds.Tables[0].Rows[0][0]);
                    }
                }

                return(retVal);
            }
        }
Esempio n. 19
0
        private void Report_Print_Preview(string action)
        {
            //XtraReport_EmployeesSalaryList Xtra_report_employeesSalaryList = new XtraReport_EmployeesSalaryList();
            XtraReport_Salary Xtra_report_employeesSalaryList = new XtraReport_Salary();

            DynamicParameters param = new DynamicParameters();

            param.Add("@Emp_Code_Processing", string.Empty);
            param.Add("@Salary_Month", DtStartDate.EditValue);
            param.Add("@Deduct_Advance", 1);
            param.Add("@Deduct_Loan", 1);
            param.Add("@TeaRate", txtteatrate.Text);
            param.Add("@NoOfCups", 0);



            //List<EmployeeSalary> EmployeesSalaryList = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", param);

            MonthlySalaryDetails_Model monthlySalaryDetails_Model = new MonthlySalaryDetails_Model
            {
                SalaryMonth         = ConvertTo.DateTimeVal(DtStartDate.EditValue),
                EmployeesSalaryList = EmployeeData.GetEmployeesSalaryList("sp_Salary_Process", param)
            };


            //MessageBox.Show(EmployeesSalaryList.Count + "");

            //salaryBindingSource.DataSource = EmployeesSalaryList;
            salaryBindingSource.DataSource = monthlySalaryDetails_Model;

            Xtra_report_employeesSalaryList.DataSource = salaryBindingSource;


            ReportPrintTool tool = new ReportPrintTool(Xtra_report_employeesSalaryList);

            if (action.Equals("preview"))
            {
                tool.ShowRibbonPreviewDialog();
            }
            if (action.Equals("print"))
            {
                tool.PrintDialog();
            }
        }
Esempio n. 20
0
        private void EditSalary_2(bool isAdded)
        {
            var ds1 = ProjectFunctions.GetDataSet("Select * from  EmpMST where EmpCode='" + Empcode + "'");

            if (ds1.Tables[0].Rows.Count > 0)
            {
                var Str = "Update EmpMST set ";
                Str = Str + " EmpBasic='" + Convert.ToDecimal(txtBasicPay.Text) + "',";
                Str = Str + " EmpHRA='" + Convert.ToDecimal(txtHRA.Text) + "',";
                Str = Str + " EmpPET='" + Convert.ToDecimal(txtPetrol.Text) + "',";
                Str = Str + " EmpConv='" + Convert.ToDecimal(txtConvenyance.Text) + "',";
                Str = Str + " EmpDUUserID='" + GlobalVariables.CurrentUser + "',";
                Str = Str + " EmDUDt='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm") + "',";
                Str = Str + " EmpSplAlw ='" + Convert.ToDecimal(txtEmpSplAlw.Text.Trim()) + "'";
                Str = Str + " Where EmpCode='" + Empcode + "'";


                if (ConvertTo.IntVal(Convert.ToDecimal(txtBasicPay.Text)) != 0)
                {
                    using (var sqlcon = new SqlConnection(ProjectFunctions.ConnectionString))
                    {
                        sqlcon.Open();
                        var sqlcom = new SqlCommand(Str, sqlcon)
                        {
                            CommandType = CommandType.Text
                        };
                        sqlcom.ExecuteNonQuery();
                    }
                    if (!isAdded)
                    {
                        ProjectFunctions.SpeakError("Salary Structure Updated.");
                    }
                    Close();
                }
                else
                {
                    ProjectFunctions.SpeakError("Basic Pay can not be 0.");
                }
            }
            else
            {
                XtraMessageBox.Show("Entry Dose not Exists For This Month Year");
            }
        }
Esempio n. 21
0
        public Converter(double usd, double eur, double rub) //переводит гривны
        {
            ConvertTo hryvniasTo = new ConvertTo();

            hryvniasTo.Dollar = 0.036 * usd;
            hryvniasTo.Euro   = 0.030 * eur;
            hryvniasTo.Ruble  = 2.68 * rub;
            Console.WriteLine("Перевод гривн в");
            Show(hryvniasTo);


            ConvertTo toHryvnias = new ConvertTo();

            toHryvnias.Dollar = 27.43 * usd;
            toHryvnias.Euro   = 33.41 * eur;
            toHryvnias.Ruble  = 0.37 * rub;
            Console.WriteLine("Перевод на гривны из");
            Show(toHryvnias);
        }
 public IActionResult ChangeUsername(ChangeUsernameModel model)
 {
     ViewBag.header = "Enter your new username";
     if (ModelState.IsValid)
     {
         var user   = ConvertTo.UserEntity(model);
         var status = userService.UpdateUsername(user, model.Username);
         if (status)
         {
             return(RedirectToAction("UserDetails", "User"));
         }
         else
         {
             ModelState.AddModelError(string.Empty, $"Username '{model.Username}' already exists");
             return(View(model));
         }
     }
     return(View(model));
 }
Esempio n. 23
0
        private void GridControl_GatePassData_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                //int rowIndex = (gridControl_GatePassData.FocusedView as ColumnView).FocusedRowHandle;

                ColumnView detailView = (ColumnView)gridControl_GatePassData.FocusedView;

                int    cellValue_serial_id = ConvertTo.IntVal(detailView.GetFocusedRowCellValue("SerialId"));
                string date_value          = detailView.GetFocusedRowCellValue("Date") + string.Empty;


                SetFormValues(0, Employee_code, date_value, cellValue_serial_id);
            }
            catch (Exception ex)
            {
                PrintLogWin.PrintLog(ex);
            }
        }
Esempio n. 24
0
 public static object To(object source, Type target, CultureInfo culture)
 {
     try
     {
         if (source == null ||
             target == typeof (object) ||
             source.GetType() == target ||
             source.GetType().GetInterfaces().Any(t => t == target))
         {
             return source;
         }
         if (target.IsGenericType && target.GetGenericTypeDefinition() == typeof(Nullable<>))
         {
             var realTarget = target.GetGenericArguments()[0];
             if (source.GetType() == realTarget ||
                 source.GetType().GetInterfaces().Any(t => t == realTarget))
             {
                 return source;
             }
             if (realTarget.IsEnum)
             {
                 return ToEnum(source, realTarget, culture);
             }
         }
         if (target.IsEnum)
         {
             return ToEnum(source, target,culture);
         }
         if (target.IsArray)
         {
             return TryArray(source, target);
         }
         var formattable = source as IFormattable;
         var text = formattable?.ToString(null, culture) ?? source.ToString();
         ConvertTo convertTo = null;
         if(!REGISTERED.TryGetValue(target, out convertTo)) throw ConvertException.CannotConvert(target, source);
         return convertTo(text, culture);
     }
     catch (FormatException)
     {
         throw ConvertException.CannotConvert(target, source);
     }
 }
Esempio n. 25
0
        public JsonResult SendMessage(Message message)
        {
            if (this.ModelState.IsValid)
            {
                message.IsSendByAdmin = true;
                message.SenderId      = ProjectSession.UserId;
                int status = this.messageDataBL.Save <Message>(message, false, false);
                if (status > 0)
                {
                    Customer customer = this.messageDataBL.SelectObject <Customer>(message.CustomerId);

                    EmailViewModel emailModel = new EmailViewModel()
                    {
                        Email        = customer.Email,
                        Name         = customer.Name,
                        AdminMessage = message.Description,
                        LanguageId   = ConvertTo.ToInteger(ProjectSession.AdminPortalLanguageId)
                    };
                    UserMail.MessageAlertForCustomer(emailModel);
                    return(this.Json(new { resultData = status, status = Infrastructure.SystemEnumList.MessageBoxType.Success.GetDescription(), message = Messages.SendMessageSuccess, title = General.Send + " " + General.Message }, JsonRequestBehavior.DenyGet));
                }

                return(this.Json(new { resultData = status, status = Infrastructure.SystemEnumList.MessageBoxType.Error.GetDescription(), message = Messages.SendMessageError }, JsonRequestBehavior.DenyGet));
            }
            else
            {
                string errorMsg = string.Empty;
                foreach (ModelState modelState in this.ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        if (!string.IsNullOrEmpty(errorMsg))
                        {
                            errorMsg = errorMsg + " , ";
                        }

                        errorMsg = errorMsg + error.ErrorMessage;
                    }
                }

                return(this.Json(new { resultData = string.Empty, status = Infrastructure.SystemEnumList.MessageBoxType.Error.GetDescription(), message = errorMsg }, JsonRequestBehavior.DenyGet));
            }
        }
Esempio n. 26
0
        public ActionResult SendEmail(string id = "MA==")
        {
            if (TempData["openPopup"] != null)
            {
                ViewBag.openPopup = TempData["openPopup"];
            }

            int Id = Convert.ToInt32(ConvertTo.Base64Decode(id));

            if (Id > 0)
            {
                var    model = abstractOpportunitiesServices.OpportunitiesSelectById(Id).Item;
                string Email = ProjectSession.Email;
                if (Email != "" && model != null)
                {
                    string Emailtext = "<p style='margin-left: 70px;'>You can see #TASK# Details Below.</p><h5 style='margin-left: 70px;'> Opportunity Name :- <span style='font-weight:bold'>#OPNAME#</span></h5><h5 style='margin-left: 70px;'> Assigned User Name :- <span style='font-weight:bold'>#ASSIGNUSRNAME#</span></h5><h5 style='margin-left: 70px;'> Company Contact Name :- <span style='font-weight:bold'>#COMCONTNAME#</span></h5><h5 style='margin-left: 70px;'> Description :- <span style='font-weight:bold'>#Description#</span></h5><h5 style='margin-left: 70px;'> Status :- <span style='font-weight:bold'>#Status#</span></h5><h5 style='margin-left: 70px;'> Start Date :- <span style='font-weight:bold'>#StartDate#</span></h5><h5 style='margin-left: 70px;'> End Date :- <span style='font-weight:bold'>#EndDate#</span></h5><h5 style='margin-left: 70px;'> Success Rate Percent :- <span style='font-weight:bold'>#SuccessRatePercent#</span></h5>";
                    string body      = string.Empty;

                    using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate/index.html")))
                    {
                        body = reader.ReadToEnd();
                    }
                    Emailtext = Emailtext.Replace("#TASK#", "Opportunity");
                    Emailtext = Emailtext.Replace("#OPNAME#", model.Name);
                    Emailtext = Emailtext.Replace("#ASSIGNUSRNAME#", model.AssignedUserName);
                    Emailtext = Emailtext.Replace("#COMCONTNAME#", model.CompanyContactName);
                    Emailtext = Emailtext.Replace("#Description#", model.Description);
                    Emailtext = Emailtext.Replace("#Status#", model.StatusName);
                    Emailtext = Emailtext.Replace("#StartDate#", model.StartDate);
                    Emailtext = Emailtext.Replace("#EndDate#", model.EndDate);
                    Emailtext = Emailtext.Replace("#SuccessRatePercent#", Convert.ToString(model.SuccessRatePercent));
                    body      = body.Replace("#TASK#", "Opportunity");
                    body      = body.Replace("#USERNAME#", ProjectSession.UserName);
                    body      = body.Replace("#MAINMESSAGE#", Emailtext);
                    //EmailHelper.Send(Email, "", "", "CRM Opportunity: " + model.Name, body);

                    System.Net.Mail.Attachment Attachment1 = EmailHelper.AddAttachment("CRM Opportunity: " + model.Name, Emailtext, model.StartDate, model.EndDate);
                    EmailHelper.Send1(Email, "", "", "CRM Opportunity: " + model.Name, body, Attachment1);
                }
            }

            return(RedirectToAction(Actions.Index, Pages.Controllers.Opportunities));
        }
Esempio n. 27
0
        public void MergeChar1(string context)
        {
            using (var db = new TestDataConnection(context))
                using (db.BeginTransaction())
                {
                    var id = ConvertTo <int> .From(db.GetTable <AllType>().InsertWithIdentity(() => new AllType
                    {
                        charDataType  = '\x0',
                        ncharDataType = "\x0"
                    }));

                    db.GetTable <AllType>()
                    .Merge()
                    .Using(db.GetTable <AllType>().Where(t => t.ID == id))
                    .OnTargetKey()
                    .UpdateWhenMatched()
                    .InsertWhenNotMatched()
                    .Merge();
                }
        }
Esempio n. 28
0
        protected override List <ForeignKeyInfo> GetForeignKeys(DataConnection dataConnection)
        {
            // this line (GetOleDbSchemaTable) could crash application hard with AV:
            // https://github.com/linq2db/linq2db.LINQPad/issues/23
            var data = ((OleDbConnection)Proxy.GetUnderlyingObject((DbConnection)dataConnection.Connection))
                       .GetOleDbSchemaTable(OleDbSchemaGuid.Foreign_Keys, null);

            var q = from fk in data.AsEnumerable()
                    select new ForeignKeyInfo
            {
                Name         = fk.Field <string>("FK_NAME"),
                ThisColumn   = fk.Field <string>("FK_COLUMN_NAME"),
                OtherColumn  = fk.Field <string>("PK_COLUMN_NAME"),
                ThisTableID  = fk.Field <string>("FK_TABLE_CATALOG") + "." + fk.Field <string>("FK_TABLE_SCHEMA") + "." + fk.Field <string>("FK_TABLE_NAME"),
                OtherTableID = fk.Field <string>("PK_TABLE_CATALOG") + "." + fk.Field <string>("PK_TABLE_SCHEMA") + "." + fk.Field <string>("PK_TABLE_NAME"),
                Ordinal      = ConvertTo <int> .From(fk.Field <long>("ORDINAL")),
            };

            return(q.ToList());
        }
Esempio n. 29
0
        public void MergeChar1(string context)
        {
            using (var db = new TestDataConnection(context))
            {
                var id = ConvertTo <int> .From(db.GetTable <AllType>().InsertWithIdentity(() => new AllType
                {
                    charDataType  = '\x0',
                    ncharDataType = "\x0"
                }));

                try
                {
                    db.Merge(db.GetTable <AllType>().Where(t => t.ID == id));
                }
                finally
                {
                    db.GetTable <AllType>().Delete(t => t.ID == id);
                }
            }
        }
Esempio n. 30
0
        protected override List <PrimaryKeyInfo> GetPrimaryKeys(DataConnection dataConnection)
        {
            var dbConnection = (DbConnection)dataConnection.Connection;
            var idxs         = dbConnection.GetSchema("Indexes");
            var cs           = dbConnection.GetSchema("IndexColumns");

            return
                ((
                     from idx in idxs.AsEnumerable()
                     join c   in cs.AsEnumerable()
                     on idx.Field <string>("TABLE_NAME") equals c.Field <string>("TABLE_NAME")
                     select new PrimaryKeyInfo
            {
                TableID = idx.Field <string>("TABLE_CATALOG") + "." + idx.Field <string>("TABLE_SCHEMA") + "." + idx.Field <string>("TABLE_NAME"),
                PrimaryKeyName = idx.Field <string>("INDEX_NAME"),
                ColumnName = c.Field <string>("COLUMN_NAME"),
                Ordinal = ConvertTo <int> .From(c["ORDINAL_POSITION"]),
            }
                     ).ToList());
        }
Esempio n. 31
0
        static void RankConverter(ConvertTo<CardInfo.RankEnum, int> c)
        {
            c.TargetInComparer = RankComparer;

            c[CardInfo.RankEnum.RankKing] = (int)SpiderRankEnum.RankKing;
            c[CardInfo.RankEnum.RankQueen] = (int)SpiderRankEnum.RankQueen;
            c[CardInfo.RankEnum.RankJack] = (int)SpiderRankEnum.RankJack;
            c[CardInfo.RankEnum.Rank10] = (int)SpiderRankEnum.Rank10;
            c[CardInfo.RankEnum.Rank9] = (int)SpiderRankEnum.Rank9;
            c[CardInfo.RankEnum.Rank8] = (int)SpiderRankEnum.Rank8;
            c[CardInfo.RankEnum.Rank7] = (int)SpiderRankEnum.Rank7;
            c[CardInfo.RankEnum.Rank6] = (int)SpiderRankEnum.Rank6;
            c[CardInfo.RankEnum.Rank5] = (int)SpiderRankEnum.Rank5;
            c[CardInfo.RankEnum.Rank4] = (int)SpiderRankEnum.Rank4;
            c[CardInfo.RankEnum.Rank3] = (int)SpiderRankEnum.Rank3;
            c[CardInfo.RankEnum.Rank2] = (int)SpiderRankEnum.Rank2;
            c[CardInfo.RankEnum.RankAce] = (int)SpiderRankEnum.RankAce;
        }
 public FreeImageColorConversion(ConvertTo conversion)
 {
     this.conversion = conversion;
 }