/// <summary>
        /// 根据公司ID删除公司信息
        /// </summary>
        /// <param name="companyID"></param>
        /// <returns></returns>
        public bool DeleteCompanyByCompanyID(int companyID, out string errorString)
        {
            Company company = new Company();
            company.ID = companyID;
            company.Name = dao.GetCompanyNameByCompanyId(companyID);
            errorString = string.Empty;

            //使用检查
            List<PlayInfo> repeatPlayinfoList = company.UsedCheck();

            //若使用则报出使用的播放信息
            if (repeatPlayinfoList != null)
            {
                foreach (PlayInfo pInfo in repeatPlayinfoList)
                {
                    errorString += "编号:" + pInfo.animeNo + "; 名称:" + GetAnimeFromAnimeNo(pInfo.animeNo).CNName +
                        "; 内容:" + pInfo.info + ";\n";
                }

                return false;
            }

            //若未使用则删除
            company.Delete();

            return true;
        }
示例#2
0
        /// <summary>
        /// 动画界面加载
        /// 指定制作公司
        /// </summary>
        /// <param name="comp"></param>
        /// <returns></returns>
        public DataSet Getanime(Company comp)
        {
            string sqlcmd = @"SELECT
                                    AT.ANIME_NO,
                                    AT.ANIME_CHN_NAME,
                                    AT.ANIME_JPN_NAME,
                                    AT.ANIME_NN,
                                    AT.STATUS,
                                    AT.ORIGINAL
                                    FROM {0} AT
                                    LEFT JOIN {1} PT ON AT.ANIME_NO=PT.ANIME_NO
                                    LEFT JOIN
                                    (
                                        SELECT ANIME_NO,MAX(START_TIME) AS TIME
                                        FROM {1}
                                        WHERE ENABLE_FLG = 1
                                        GROUP BY ANIME_NO
                                    ) AS WT ON AT.ANIME_NO = WT.ANIME_NO
                                    WHERE PT.COMPANY_ID	= @companyid
                                    AND AT.ENABLE_FLG = 1
                                    AND PT.ENABLE_FLG = 1
                                    ORDER BY CHARINDEX(RTRIM(CAST(AT.STATUS as NCHAR)),'1,3,2,9') ,
                                    WT.TIME DESC";

            Collection<DbParameter> paras = new Collection<DbParameter>();
            paras.Add(new SqlParameter("@companyid", comp.ID));
            return DbCmd.DoSelect(string.Format(sqlcmd
                , CommonConst.TableName.T_ANIME_TBL
                , CommonConst.TableName.T_PLAYINFO_TBL
                ), paras);
        }
示例#3
0
        /// <summary>
        /// 插入公司信息
        /// </summary>
        /// <param name="comp"></param>
        public void InsertCompanyInfo(Company comp)
        {
            string sqlcmd = @"INSERT INTO {0}(
                                        COMPANY_ID,
                                        COMPANY_NAME,
                                        ENABLE_FLG,
                                        LAST_UPDATE_DATETIME)
                                        VALUES(
                                        @companyid,
                                        @companyname,
                                        1,
                                        GETDATE())";

            Collection<DbParameter> paras = new Collection<DbParameter>();
            paras.Add(new SqlParameter("@companyid", comp.ID));
            paras.Add(new SqlParameter("@companyname", comp.Name));

            DbCmd.DoCommand(string.Format(sqlcmd, CommonConst.TableName.T_COMPANY_TBL), paras);
        }
示例#4
0
        /// <summary>
        /// 修改公司
        /// </summary>
        /// <returns></returns>
        private bool UpdateCompany()
        {
            List<Company> NeedUpdateCompanys = new List<Company>();

            foreach (DataGridViewRow dr in CompanyDataGridView.Rows)
            {
                if (dr.Cells[1].Value == null || dr.Cells[1].Value.ToString().Trim().Equals(string.Empty))
                {
                    MsgBox.Show(MSG_COMPANYMANAGE_002);
                    return false;
                }

                Company newCmpInfo = new Company();
                newCmpInfo.ID = Convert.ToInt32(dr.Cells[0].Value);
                newCmpInfo.Name = dr.Cells[1].Value.ToString();

                var targetCmp = from cmp in this.companyList
                                where cmp.CompanyID == newCmpInfo.ID
                                select cmp;

                foreach (CompanyListRow clr in targetCmp)
                {
                    if(!clr.CompanyName.Equals(newCmpInfo.Name))
                    {
                        NeedUpdateCompanys.Add(newCmpInfo);
                    }

                }
            }

            if (NeedUpdateCompanys.Count == 0)
            {
                MsgBox.Show(MSG_COMPANYMANAGE_003);
                return false;
            }

            if(MsgBox.Show(MSG_COMMON_008)==DialogResult.Yes)
            {

                foreach (Company cmp in NeedUpdateCompanys)
                {
                    service.UpdateCompanyInfo(cmp.Name, cmp.ID);
                }

                MsgBox.Show(MSG_COMMON_003);
                LoadCompany();
                return true;
            }

            return false;
        }
示例#5
0
        /// <summary>
        /// 展示选中公司履历
        /// </summary>
        /// <param name="cmp">选中公司</param>
        private void ShowCompanyHistInfo(Company cmp)
        {
            companyHistDataGridView.Rows.Clear();

            if (cmp == null)
            {
                return;
            }

            var targetHists = from cmpHist in this.companyHist
                              where cmpHist.CompanyID == cmp.ID
                              orderby cmpHist.AnimeNo,cmpHist.StartTime
                              select cmpHist;

            foreach (CompanyHistRow chr in targetHists)
            {

                DataGridViewRow dgr = companyHistDataGridView.Rows[companyHistDataGridView.Rows.Add()];

                dgr.Cells[ANIMENOCLN].Value = chr.AnimeNo;
                dgr.Cells[ANIMENAMECLN].Value = chr.AnimeCNName;
                dgr.Cells[PLAYINFOCLN].Value = chr.Playinfo;
                if (chr.Parts != 0)
                {
                    dgr.Cells[PARTSCLN].Value = chr.Parts.ToString();
                }

                dgr.Cells[STATUSCLN].Value = service.GetStatusTextFromStatusInt(chr.PlayinfoStatus);

                if (chr.StartTime != DateTime.MinValue && chr.StartTime != DateTime.MaxValue)
                {
                    dgr.Cells[STARTTIMECLN].Value = service.ConvertToYYYYNianMMYueFromDatetime(chr.StartTime);
                }

            }

            //状态格式
            foreach (DataGridViewRow dr in companyHistDataGridView.Rows)
            {
                int status = service.GetStatusIntFromStatusText(dr.Cells[STATUSCLN].Value.ToString());
                dr.Cells[STATUSCLN].Style = statusStyle.GetStatusRowStyle(status);
            }

            for (int i = 0; i < companyHistDataGridView.ColumnCount; i++)
            {
                companyHistDataGridView.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                companyHistDataGridView.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            }
        }
示例#6
0
        /// <summary>
        /// 获得选中行公司
        /// </summary>
        /// <returns></returns>
        private Company GetSelectedCompany()
        {
            if (CompanyDataGridView.CurrentCell == null)
                return null;
            int idx = CompanyDataGridView.CurrentRow.Index;
            DataGridViewRow currentRow = CompanyDataGridView.Rows[idx];
            if (currentRow.Cells[COMNAMECLN].Value == null)
            {
                return null;
            }

            Company comp = new Company();
            comp.Name = currentRow.Cells[COMNAMECLN].Value.ToString();
            comp.ID = Convert.ToInt32(currentRow.Cells[COMIDCLN].Value);
            return comp;
        }
示例#7
0
        /// <summary>
        /// 根据公司名返回公司ID、新规公司信息
        /// </summary>
        /// <param name="companyName"></param>
        /// <returns></returns>
        public int SetCompanyIDByCompanyName(string companyName)
        {
            int companyID = dao.GetCompanyIdByCompanyName(companyName);

            if (companyID >= 0)
            {
                return companyID;
            }

            //新规company作成
            Company comp = new Company();
            comp.ID = dao.GetMaxInt(2) + 1;
            comp.Name = companyName;

            //company表插入
            try
            {
                dao.InsertCompanyInfo(comp);
                return comp.ID;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#8
0
 /// <summary>
 /// 载入动画
 /// 指定公司制作
 /// </summary>
 /// <param name="comp">制作公司</param>
 /// <returns></returns>
 public DataSet Getanime(Company comp)
 {
     return dao.Getanime(comp);
 }