protected void PerformMove(string CID, string acout)
        {
            SqlConnection LAconn = new SqlConnection();
            var           conn   = CONNSTRING;

            LAconn.ConnectionString = conn;
            var        comDal           = new CompanyDAL(conn);
            var        OwnerId          = acout;
            ILog       _logger          = LogManager.GetLogger(typeof(AccountMoveHouseDAL));
            String     strSQLInsertStmt = "UPDATE dbo.Companies SET OwnershipAdminID = @OwnershipAdminID, AlteredDateTime=CURRENT_TIMESTAMP, OwnershipPeriod = NULL WHERE CompanyID =@CompanyID";
            SqlCommand LAcmd            = new SqlCommand(strSQLInsertStmt, LAconn);

            LAcmd.Parameters.AddWithValue("@OwnershipAdminID", OwnerId);
            LAcmd.Parameters.AddWithValue("@CompanyID", CID);
            try
            {
                LAconn.Open();
                LAcmd.ExecuteNonQuery();
                LAconn.Close();
            }
            catch (Exception ex)
            {
                _logger.Error("Error occurred at PerformMove method" + ex);
                //  Console.Write(ex.Message.ToString());
            }
        }
        private string getQuoteNotes(int quoteId)
        {
            var connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;

            var companyNote = new DeltoneCRM_DAL.CompanyDAL(connectionstring).getQuoteCompanyNotes(quoteId.ToString());


            var           loggedInUserId = Convert.ToInt32(HttpContext.Current.Session["LoggedUserID"].ToString());
            SqlConnection conn           = new SqlConnection();

            conn.ConnectionString = connectionstring;


            return(companyNote);
        }
        protected bool MoveAccountToHouseAccount(List <CompanyByOrderCreatedDate> listCompanies)
        {
            var  status   = true;
            var  hourAcco = "7";
            ILog _logger  = LogManager.GetLogger(typeof(AccountMoveHouseDAL));

            foreach (var item in listCompanies)
            {
                var comdal   = new CompanyDAL(CONNSTRING);
                var resComId = comdal.CheckCompanyOwnerByID(item.CompanyId);
                try
                {
                    if (string.IsNullOrEmpty(resComId))
                    {
                        comdal.CreateOwnerCompanyId(item.CompanyId, item.OwnerId.ToString());
                    }
                }
                catch (Exception ex)
                {
                    _logger.Error("Error occurred at MoveAccountToHouseAccount method : CreateOwnerCompanyId" + ex);
                    status = false;
                }
                try
                {
                    PerformMove(item.CompanyId, hourAcco);
                    WriteErrorLog(item.CompanyId + ",");
                }

                catch (Exception exc)
                {
                    _logger.Error("Error occurred at MoveAccountToHouseAccount method : PerformMove" + exc);
                    status = false;
                }
            }
            return(status);
        }
Exemplo n.º 4
0
        public static int addEvent(DeltoneCRM.DataHandlers.DisplayEventHandler.ImproperCalendarEvent improperEvent)
        {
            string cs        = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            var    startDate = Convert.ToDateTime(improperEvent.start);
            //   var endateObj = Convert.ToDateTime(improperEvent.end);
            var endDate = startDate.AddHours(1);
            //if (startDate != endateObj)
            // endDate = endateObj;


            var isAllDay = false;

            DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent cevent = new DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent()
            {
                title       = improperEvent.title,
                description = improperEvent.description,
                start       = startDate,
                end         = endDate,
                allDay      = isAllDay,
                color       = improperEvent.color
            };

            var comId = 0;

            if (HttpContext.Current.Session["companyId"] != null)
            {
                comId = Convert.ToInt32(HttpContext.Current.Session["companyId"].ToString());
            }

            cevent.url = string.Format(UrlCompany, comId);

            var userId = 0;

            if (HttpContext.Current.Session["LoggedUserID"] != null)
            {
                userId = Convert.ToInt32(HttpContext.Current.Session["LoggedUserID"].ToString());
            }
            int key = new CalendarEventDAL(cs).addEvent(cevent, comId, userId);

            //List<int> idList = (List<int>)System.Web.HttpContext.Current.Session["idList"];

            //if (idList != null)
            //{
            //    idList.Add(key);
            //}


            var           connectionstring = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString;
            SqlConnection conn             = new SqlConnection();

            conn.ConnectionString = connectionstring;

            var columnName  = "CalendarEvent all columns Order";
            var talbeName   = "CalendarEvent";
            var ActionType  = "Event Created";
            int primaryKey  = key;
            var companyName = new DeltoneCRM_DAL.CompanyDAL(connectionstring).getCompanyNameByID(comId.ToString());
            var lastString  = "Event Scheduled for company " + companyName + ": " + cevent.title;

            new DeltoneCRM_DAL.CompanyDAL(connectionstring).CreateActionONAuditLog("", lastString, userId, conn, 0,
                                                                                   columnName, talbeName, ActionType, primaryKey, comId);


            return(key); //return the primary key of the added cevent object



            return(-1); //return a negative number just to signify nothing has been added
        }