コード例 #1
0
        protected void btnUpload_Click(object sender, EventArgs e)
        {
            int            id    = CompanyID;
            CompanysEntity model = companyApp.GetCompany(id);

            if (fileLogo.HasFile)
            {
                if (".jpg.png.gif.bmp".IndexOf(Path.GetExtension(fileLogo.FileName).ToLower()) >= 0)
                {
                    model.Logo = UtilFactory.Helpers.FileHelper.SaveUploadFiles("Company", model.ID, fileLogo.PostedFile);
                    if (companyApp.UpdateCompany(model))
                    {
                        InitControl(model);
                        BaseWebsitePage.ShowSuccessMessageToClient(false, false);
                    }
                    else
                    {
                        BaseWebsitePage.ShowFailMessageToClient();
                    }
                }
                else
                {
                    BaseWebsitePage.ShowMessageToClient("The image format is incorrect!", 0, false, false);
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Get an object entity
        /// </summary>
        public CompanysEntity Get(int ComID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ComID,CompanyName,Phone,Fax,Website,AssignedSystemUrl,Address1,Address2,City,State,Logo,Status,CreatedOn,CreatedBy,CreateUserName,ModifiedOn,ModifiedBy from Companys ");
            strSql.Append(" where ComID=@ComID ");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "ComID", DbType.Int32, ComID);
                    CompanysEntity model = null;
                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        if (dataReader.Read())
                        {
                            model = CompanysEntity.ReaderBind(dataReader, false);
                        }
                    }
                    return(model);
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]", strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                    return(null);
                }
            }
        }
コード例 #3
0
        public List <CompanysEntity> GetCompaniesHasProject()
        {
            int    comId  = GetCompanyId("Sunnet");
            string strSql = string.Format(" Select distinct C.* from Projects U inner join Companys C on U.CompanyID=C.ComID where C.ComID != '{0}' order by CompanyName", comId);
            List <CompanysEntity> list = new List <CompanysEntity>();
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql))
            {
                try
                {
                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        while (dataReader.Read())
                        {
                            list.Add(CompanysEntity.ReaderBind(dataReader, false));
                        }
                    }
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                    strSql,
                                                    base.FormatParameters(dbCommand.Parameters),
                                                    ex.Message));
                }
                return(list);
            }
        }
コード例 #4
0
        private void InitControls()
        {
            int            id    = CompanyID;
            CompanysEntity model = companyApp.GetCompany(id);

            txtAddress1.Text = model.Address1;
            txtAddress2.Text = model.Address2;
            //model.AssignedSystemUrl = "http://client.sunnet.us";
            txtCity.Text        = model.City;
            txtCompanyName.Text = model.CompanyName;
            txtFax.Text         = model.Fax;
            txtPhone.Text       = model.Phone;
            ListItem state = ddlState.Items.FindByText(model.State);

            if (state != null)
            {
                state.Selected = true;
            }
            txtWebsite.Text = model.Website;

            InitControl(model);

            InitProjects();
            InitUsers();

            if (CompanyID == 1)
            {
                phFiles.Visible = false;
            }
            else
            {
                phFiles.Visible = true;
                InitFiles();
            }
        }
コード例 #5
0
        private void InitCompanyInfo()
        {
            CompanyApplication comApp  = new CompanyApplication();
            CompanysEntity     company = comApp.GetCompany(UserInfo.CompanyID);

            if (UserInfo.CompanyID == 1)  //Sunnet 公司
            {
                ltLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                            , BuilderLogo(company.Logo));
            }
            else
            {
                CompanysEntity sunntCompanyEntity = comApp.GetCompany(1); //获取Sunnet公司

                if (company.Logo.IndexOf("logomain.jpg") >= 0)            //没有上传Logo ,则显示 Sunnet 公司Logo
                {
                    ltLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                                , BuilderLogo(sunntCompanyEntity.Logo));
                }
                else
                {
                    ltLogo.Text = BuilderLogo(company.Logo);

                    ltSunnetLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                                      , BuilderLogo(sunntCompanyEntity.Logo));
                }
            }
        }
コード例 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="oldCompanyName">check new company name if changed,else sent null</param>
        /// <returns></returns>
        public bool UpdateCompany(CompanysEntity model)
        {
            this.ClearBrokenRuleMessages();
            bool result = mgr.UpdateCompany(model);

            this.AddBrokenRuleMessages(mgr.BrokenRuleMessages);
            return(result);
        }
コード例 #7
0
        public CompanysEntity GetCompany(int id)
        {
            this.ClearBrokenRuleMessages();
            CompanysEntity model = mgr.GetCompany(id);

            this.AddBrokenRuleMessages(mgr.BrokenRuleMessages);
            return(model);
        }
コード例 #8
0
        public int AddCompany(CompanysEntity model)
        {
            this.ClearBrokenRuleMessages();
            int id = mgr.AddCompany(model);

            this.AddBrokenRuleMessages(mgr.BrokenRuleMessages);
            return(id);
        }
コード例 #9
0
        private void InitCompany()
        {
            var            comApp  = new CompanyApplication();
            CompanysEntity company = comApp.GetCompany(UserInfo.CompanyID);

            if (company != null)
            {
                ltlCompany.Text = company.CompanyName;
            }
        }
コード例 #10
0
        protected void iBtnDeleteLogo_Click(object sender, ImageClickEventArgs e)
        {
            int            id    = CompanyID;
            CompanysEntity model = companyApp.GetCompany(id);

            model.Logo = "/Images/nologo.jpg";
            InitControl(model);
            if (companyApp.UpdateCompany(model))
            {
                BaseWebsitePage.ShowSuccessMessageToClient(false, false);
            }
            else
            {
                BaseWebsitePage.ShowFailMessageToClient();
            }
        }
コード例 #11
0
        protected void iBtnDeleteLogo_Click(object sender, ImageClickEventArgs e)
        {
            int            id    = CompanyID;
            CompanysEntity model = companyApp.GetCompany(id);

            model.Logo = "/Images/nologo.jpg";
            InitControl(model);
            if (companyApp.UpdateCompany(model))
            {
                Redirect(Request.RawUrl, true);
            }
            else
            {
                ShowFailMessageToClient();
            }
        }
コード例 #12
0
        /// <summary>
        /// Add a record
        /// </summary>
        public int Insert(CompanysEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Companys(");
            strSql.Append("CompanyName,Phone,Fax,Website,AssignedSystemUrl,Address1,Address2,City,State,Logo,Status,CreatedOn,CreatedBy,CreateUserName,ModifiedOn,ModifiedBy)");

            strSql.Append(" values (");
            strSql.Append("@CompanyName,@Phone,@Fax,@Website,@AssignedSystemUrl,@Address1,@Address2,@City,@State,@Logo,@Status,@CreatedOn,@CreatedBy,@CreateUserName,@ModifiedOn,@ModifiedBy)");
            strSql.Append(";select ISNULL( SCOPE_IDENTITY(),0);");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "CompanyName", DbType.String, model.CompanyName);
                    db.AddInParameter(dbCommand, "Phone", DbType.String, model.Phone);
                    db.AddInParameter(dbCommand, "Fax", DbType.String, model.Fax);
                    db.AddInParameter(dbCommand, "Website", DbType.String, model.Website);
                    db.AddInParameter(dbCommand, "AssignedSystemUrl", DbType.String, model.AssignedSystemUrl);
                    db.AddInParameter(dbCommand, "Address1", DbType.String, model.Address1);
                    db.AddInParameter(dbCommand, "Address2", DbType.String, model.Address2);
                    db.AddInParameter(dbCommand, "City", DbType.String, model.City);
                    db.AddInParameter(dbCommand, "State", DbType.String, model.State);
                    db.AddInParameter(dbCommand, "Logo", DbType.String, model.Logo);
                    db.AddInParameter(dbCommand, "Status", DbType.String, model.Status);
                    db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, model.CreatedOn);
                    db.AddInParameter(dbCommand, "CreatedBy", DbType.Int32, model.CreatedBy);
                    db.AddInParameter(dbCommand, "CreateUserName", DbType.String, model.CreateUserName);
                    db.AddInParameter(dbCommand, "ModifiedOn", DbType.DateTime, model.ModifiedOn);
                    db.AddInParameter(dbCommand, "ModifiedBy", DbType.Int32, model.ModifiedBy);
                    int    result;
                    object obj = db.ExecuteScalar(dbCommand);
                    if (!int.TryParse(obj.ToString(), out result))
                    {
                        return(0);
                    }
                    return(result);
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]", strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                    return(0);
                }
            }
        }
コード例 #13
0
        public CompanysEntity ToBusinessEntity(ISystemDateTime timeProvider)
        {
            CompanysEntity companyEntity = CompanyFactory.Create(this.PostByUserID, timeProvider);

            companyEntity.Address1          = this.Address1;
            companyEntity.Address2          = this.Address2;
            companyEntity.AssignedSystemUrl = this.AssignedSystemUrl;
            companyEntity.City        = this.City;
            companyEntity.CompanyName = this.CompanyName;
            companyEntity.Fax         = this.Fax;
            companyEntity.Logo        = this.Logo;
            companyEntity.Phone       = this.Phone;
            companyEntity.State       = this.State;
            companyEntity.Status      = this.Status;
            companyEntity.Website     = this.Website;

            return(companyEntity);
        }
コード例 #14
0
ファイル: FilesList.aspx.cs プロジェクト: KhaledSMQ/SunNet.PM
        private void InitCompany()
        {
            CompanyApplication comApp = new CompanyApplication();

            if (UserInfo.Role == RolesEnum.CLIENT)
            {
                CompanysEntity model = comApp.GetCompany(UserInfo.CompanyID);
                ddlCompany.Items.Add(new ListItem(model.CompanyName, model.ID.ToString()));
                tdCompanyLabel.Visible = false;
                tdCompanyDdl.Visible   = false;
            }
            else
            {
                List <CompanysEntity> list = comApp.GetAllCompanies();
                list.BindDropdown <CompanysEntity>(ddlCompany, "CompanyName", "ID", "All", "0");
            }
            ddlCompany_OnSelectedIndexChanged(null, null);
        }
コード例 #15
0
        protected CompanysEntity GetEntity()
        {
            CompanysEntity model = CompanyFactory.CreateCompanys(UserInfo.UserID, ObjectFactory.GetInstance <ISystemDateTime>());

            model.Address1          = txtAddress1.Text.NoHTML();
            model.Address2          = txtAddress2.Text.NoHTML();
            model.AssignedSystemUrl = "http://client.sunnet.us";
            model.City           = txtCity.Text.NoHTML();
            model.CompanyName    = txtCompanyName.Text.NoHTML();
            model.CreateUserName = UserInfo.UserName;
            model.Fax            = txtFax.Text;
            model.Logo           = "/Images/logomain.jpg";
            model.Phone          = txtPhone.Text;
            model.State          = ddlState.SelectedItem.Text;
            model.Status         = "ACTIVE";
            model.Website        = txtWebsite.Text;

            return(model);
        }
コード例 #16
0
        private void InitControl(CompanysEntity model)
        {
            string noImg = " - Please upload a logo image in format JPG PNG GIF or BMP  , size(width:230px,height:77px)";

            try
            {
                string fileName = Server.MapPath(model.Logo);
                if (File.Exists(fileName))
                {
                    System.Drawing.Image image = Bitmap.FromFile(Server.MapPath(model.Logo));
                    if (image.Width > 230)
                    {
                        imgLogo.Height = image.Height * 230 / image.Width;
                        imgLogo.Width  = 230;
                    }
                    imgLogo.ImageUrl = model.Logo.Replace("//", "/");
                    ltlNoLogo.Text   = "";
                    if (model.Logo.IndexOf("logomain.jpg") >= 0)
                    {
                        SetNoLogo();
                        iBtnDeleteLogo.Visible = false;
                        ltlNoLogo.Text         = noImg;
                    }
                    else
                    {
                        iBtnDeleteLogo.Visible = true;
                    }
                }
                else
                {
                    SetNoLogo();
                    ltlNoLogo.Text = noImg;
                }
            }
            catch (OutOfMemoryException ooex)
            {
                WebLogAgent.Write(ooex);
                SetNoLogo();
                iBtnDeleteLogo.Visible = false;
                ltlNoLogo.Text         = noImg;
            }
        }
コード例 #17
0
        protected CompanysEntity GetEntity()
        {
            int            id    = CompanyID;
            CompanysEntity model = companyApp.GetCompany(id);

            model.Address1 = txtAddress1.Text;
            model.Address2 = txtAddress2.Text;
            //model.AssignedSystemUrl = "http://client.sunnet.us";
            model.City           = txtCity.Text;
            model.CompanyName    = txtCompanyName.Text;
            model.CreateUserName = UserInfo.UserName;
            model.Fax            = txtFax.Text;
            //model.Logo = "/Images/nologo.jpg";
            model.Phone = txtPhone.Text;
            model.State = ddlState.SelectedItem.Text;
            //model.Status = "ACTIVE";
            model.Website = txtWebsite.Text;

            return(model);
        }
コード例 #18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            if (!CheckInput(out msg))
            {
                ShowMessageToClient(msg, 2, false, false);
                return;
            }
            CompanysEntity model = GetEntity();

            if (companyApp.UpdateCompany(model))
            {
                Redirect(Request.RawUrl, true);
            }
            else
            {
                ShowFailMessageToClient(companyApp.BrokenRuleMessages, false);
            }
        }
コード例 #19
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            if (!CheckInput(out msg))
            {
                BaseWebsitePage.ShowMessageToClient(msg, 2, false, false);
                return;
            }
            CompanysEntity model = GetEntity();

            if (companyApp.UpdateCompany(model))
            {
                InitControl(model);
                BaseWebsitePage.ShowSuccessMessageToClient(false, false);
            }
            else
            {
                BaseWebsitePage.ShowFailMessageToClient(companyApp.BrokenRuleMessages, false);
            }
        }
コード例 #20
0
        private void InitCompany()
        {
            CompanyApplication comApp = new CompanyApplication();

            if (UserInfo.Role == RolesEnum.CLIENT)
            {
                CompanysEntity model = comApp.GetCompany(UserInfo.CompanyID);
                ddlCompany.Items.Add(new ListItem(model.CompanyName, model.ID.ToString()));
                tdCompanyLabel.Visible = false;
                tdCompanyDdl.Visible   = false;

                ltlWhosCompany.Text = "";
            }
            else
            {
                List <CompanysEntity> list = comApp.GetAllCompanies();
                list = list.FindAll(c => c.ID > 1);
                list.BindDropdown <CompanysEntity>(ddlCompany, "CompanyName", "ID", "All", "0");
                ltlWhosCompany.Text = " - All company files";
            }
        }
コード例 #21
0
ファイル: Main.Master.cs プロジェクト: KhaledSMQ/SunNet.PM
        private void InitCompanyInfo()
        {
            IEncrypt           encrypt = UtilFactory.GetEncryptProvider(EncryptType.DES);
            CompanyApplication comApp  = new CompanyApplication();
            CompanysEntity     company = comApp.GetCompany(UserInfo.CompanyID);

            if (UserInfo.CompanyID == 1)  //Sunnet 公司
            {
                ltLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                            , BuilderLogo(company.Logo));
                UtilFactory.Helpers.CookieHelper.Add(encrypt.Encrypt("LtLogo"),
                                                     encrypt.Encrypt(ltLogo.Text), DateTime.Now.AddMinutes(30));
            }
            else
            {
                CompanysEntity sunntCompanyEntity = comApp.GetCompany(1); //获取Sunnet公司

                if (company.Logo.IndexOf("logomain.jpg") >= 0)            //没有上传Logo ,则显示 Sunnet 公司Logo
                {
                    ltLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                                , BuilderLogo(sunntCompanyEntity.Logo));
                    UtilFactory.Helpers.CookieHelper.Add(encrypt.Encrypt("LtLogo"),
                                                         encrypt.Encrypt(ltLogo.Text), DateTime.Now.AddMinutes(30));
                }
                else
                {
                    ltLogo.Text = BuilderLogo(company.Logo);

                    ltSunnetLogo.Text = string.Format("<a href=\"http://www.sunnet.us\" target=\"_blank\">{0}</a>"
                                                      , BuilderLogo(sunntCompanyEntity.Logo));


                    UtilFactory.Helpers.CookieHelper.Add(encrypt.Encrypt("LtLogo"),
                                                         encrypt.Encrypt(ltLogo.Text), DateTime.Now.AddMinutes(30));
                    UtilFactory.Helpers.CookieHelper.Add(encrypt.Encrypt("LtSunnetLogo"),
                                                         encrypt.Encrypt(ltSunnetLogo.Text), DateTime.Now.AddMinutes(30));
                }
            }
        }
コード例 #22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string msg = string.Empty;

            if (!CheckInput(out msg))
            {
                this.ShowMessageToClient(msg, 2, false, false);
                return;
            }
            CompanysEntity model = GetEntity();

            int id = companyApp.AddCompany(model);

            if (id > 0)
            {
                this.ShowSuccessMessageToClient();
                //Response.Redirect(string.Format("EditCompany.aspx?id={0}", id.ToString()));
            }
            else
            {
                this.ShowFailMessageToClient(companyApp.BrokenRuleMessages);
            }
        }
コード例 #23
0
        public SearchCompaniesResponse SearchCompanies(SearchCompaniesRequest request)
        {
            int start = request.CurrentPage * request.PageCount + 1 - request.PageCount;
            int end   = request.CurrentPage * request.PageCount;

            string        strSelCount        = " SELECT  COUNT(1)  FROM [Companys] ";
            string        strOrderby         = string.Format(" {0} {1} ", request.OrderExpression, request.OrderDirection);
            string        strSelAttrs        = @" SELECT *
                                    ,(SELECT COUNT(1) FROM Projects WHERE CompanyID = COM.ComID) AS ProjectsCount 
                                    ,(SELECT COUNT(1) FROM Users WHERE CompanyID = COM.ComID) AS ClientsCount
                                    FROM [Companys]  COM ";
            string        strSelAttrsOrderBy = string.Format(@" Order BY {0}  ", strOrderby);
            string        strSelPageModel    = string.Format(@"SELECT * FROM(
                                                SELECT ROW_NUMBER() OVER(
                                                Order BY {0}) as  INDEX_ID,*
                                                ,(SELECT COUNT(1) FROM Projects WHERE CompanyID = COM.ComID) AS ProjectsCount  
                                                ,(SELECT COUNT(1) FROM Users WHERE CompanyID = COM.ComID) AS ClientsCount 
                                                FROM [Companys] COM ", strOrderby);
            string        strWherePageModel  = @") NEW_TB  WHERE INDEX_ID BETWEEN @Strat AND  @End;";
            StringBuilder strWhere           = new StringBuilder();

            strWhere.Append(" WHERE 1=1 ");
            switch (request.SearchType)
            {
            case SearchCompanyType.SingleCompany:
                strWhere.Append(" AND [ComID]= @ComID ");
                break;

            case SearchCompanyType.Project:
                strWhere.Append(" AND [ComID] IN (SELECT CompanyID FROM Projects WHERE ProjectID =@ProjectID) ");
                break;

            case SearchCompanyType.User:
                strWhere.Append(" AND [ComID] IN (SELECT CompanyID FROM Users WHERE UserID =@UserID) ");
                break;

            case SearchCompanyType.List:
                strWhere.Append(" AND (CompanyName like @CompanyName or State  like @CompanyName or City  like @CompanyName )  ");
                break;

            case SearchCompanyType.All:
                break;

            default:
                break;
            }

            StringBuilder strSql = new StringBuilder();

            if (request.IsPageModel)
            {
                strSql.Append(strSelCount);
                strSql.Append(strWhere);
                strSql.Append(";");
                strSql.Append(strSelPageModel);
                strSql.Append(strWhere);
                strSql.Append(strWherePageModel);
            }
            else
            {
                strSql.Append(strSelAttrs);
                strSql.Append(strWhere);
                strSql.Append(strSelAttrsOrderBy);
                strSql.Append(";");
            }
            SearchCompaniesResponse response = new SearchCompaniesResponse();
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "UserID", DbType.Int32, request.UserID);
                    db.AddInParameter(dbCommand, "ProjectID", DbType.Int32, request.ProjectID);
                    db.AddInParameter(dbCommand, "ComID", DbType.Int32, request.ComID);
                    db.AddInParameter(dbCommand, "CompanyName", DbType.String, string.Format("%{0}%", request.CompanyName.FilterSqlString()));

                    db.AddInParameter(dbCommand, "Strat", DbType.Int32, start);
                    db.AddInParameter(dbCommand, "End", DbType.Int32, end);

                    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
                    {
                        List <CompanysEntity> list = new List <CompanysEntity>();

                        if (request.IsPageModel)
                        {
                            if (dataReader.Read())
                            {
                                response.ResultCount = dataReader.GetInt32(0);
                                dataReader.NextResult();
                            }
                        }
                        while (dataReader.Read())
                        {
                            list.Add(CompanysEntity.ReaderBind(dataReader, true));
                        }
                        response.ResultList = list;
                    }
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]",
                                                    strSql.ToString(),
                                                    base.FormatParameters(dbCommand.Parameters),
                                                    ex.Message));
                }
            }
            return(response);
        }
コード例 #24
0
        /// <summary>
        /// Update a record
        /// </summary>
        public bool Update(CompanysEntity model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Companys set ");
            strSql.Append("CompanyName=@CompanyName,");
            strSql.Append("Phone=@Phone,");
            strSql.Append("Fax=@Fax,");
            strSql.Append("Website=@Website,");
            strSql.Append("AssignedSystemUrl=@AssignedSystemUrl,");
            strSql.Append("Address1=@Address1,");
            strSql.Append("Address2=@Address2,");
            strSql.Append("City=@City,");
            strSql.Append("State=@State,");
            strSql.Append("Logo=@Logo,");
            strSql.Append("Status=@Status,");
            strSql.Append("CreatedOn=@CreatedOn,");
            strSql.Append("CreatedBy=@CreatedBy,");
            strSql.Append("CreateUserName=@CreateUserName,");
            strSql.Append("ModifiedOn=@ModifiedOn,");
            strSql.Append("ModifiedBy=@ModifiedBy");
            strSql.Append(" where ComID=@ComID ");
            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString()))
            {
                try
                {
                    db.AddInParameter(dbCommand, "ComID", DbType.Int32, model.ComID);
                    db.AddInParameter(dbCommand, "CompanyName", DbType.String, model.CompanyName);
                    db.AddInParameter(dbCommand, "Phone", DbType.String, model.Phone);
                    db.AddInParameter(dbCommand, "Fax", DbType.String, model.Fax);
                    db.AddInParameter(dbCommand, "Website", DbType.String, model.Website);
                    db.AddInParameter(dbCommand, "AssignedSystemUrl", DbType.String, model.AssignedSystemUrl);
                    db.AddInParameter(dbCommand, "Address1", DbType.String, model.Address1);
                    db.AddInParameter(dbCommand, "Address2", DbType.String, model.Address2);
                    db.AddInParameter(dbCommand, "City", DbType.String, model.City);
                    db.AddInParameter(dbCommand, "State", DbType.String, model.State);
                    db.AddInParameter(dbCommand, "Logo", DbType.String, model.Logo);
                    db.AddInParameter(dbCommand, "Status", DbType.String, model.Status);
                    db.AddInParameter(dbCommand, "CreatedOn", DbType.DateTime, model.CreatedOn);
                    db.AddInParameter(dbCommand, "CreatedBy", DbType.Int32, model.CreatedBy);
                    db.AddInParameter(dbCommand, "CreateUserName", DbType.String, model.CreateUserName);
                    db.AddInParameter(dbCommand, "ModifiedOn", DbType.DateTime, model.ModifiedOn);
                    db.AddInParameter(dbCommand, "ModifiedBy", DbType.Int32, model.ModifiedBy);
                    int rows = db.ExecuteNonQuery(dbCommand);

                    if (rows > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                catch (Exception ex)
                {
                    WebLogAgent.Write(string.Format("[SQLText:{0},{1}Messages:\r\n{2}]", strSql.ToString(), base.FormatParameters(dbCommand.Parameters), ex.Message));
                    return(false);
                }
            }
        }