Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            BitAuto.YanFa.SysRightManager.Common.UserInfo.Check();
            context.Response.ContentType = "text/plain";
            int    userID = BLL.Util.GetLoginUserID();
            string msg    = "";

            if (Action == "Generate")
            {
                if (!BLL.Util.CheckRight(userID, "SYS024MOD510203"))
                {
                    msg = "result:'false',msg:'您没有权限执行此操作!'";
                }
                else if (recid != "")
                {
                    Generate(out msg);
                }
                else
                {
                    msg += "参数格式不正确";
                }
            }
            else if (Action == "SaveExcelTemplate")
            {
                int            RecID      = int.Parse(recid);
                Entities.TPage tpageModel = BLL.TPage.Instance.GetTPage(RecID);
                SaveExcelTemplate(tpageModel, out msg);
            }

            context.Response.Write(msg);
        }
Example #2
0
        private Entities.TPage LoadSingleTPage(DataRow row)
        {
            Entities.TPage model = new Entities.TPage();

            if (row["RecID"].ToString() != "")
            {
                model.RecID = int.Parse(row["RecID"].ToString());
            }
            model.TPName = row["TPName"].ToString();
            if (row["BGID"].ToString() != "")
            {
                model.BGID = int.Parse(row["BGID"].ToString());
            }
            if (row["SCID"].ToString() != "")
            {
                model.SCID = int.Parse(row["SCID"].ToString());
            }
            model.TPRef          = row["TPRef"].ToString();
            model.TTCode         = row["TTCode"].ToString();
            model.GenTempletPath = row["GenTempletPath"].ToString();
            model.TPContent      = row["TPContent"].ToString();
            model.TTName         = row["TTName"].ToString();
            if (row["Status"].ToString() != "")
            {
                model.Status = int.Parse(row["Status"].ToString());
            }
            if (row["CreateTime"].ToString() != "")
            {
                model.CreateTime = DateTime.Parse(row["CreateTime"].ToString());
            }
            if (row["CreateUserID"].ToString() != "")
            {
                model.CreateUserID = int.Parse(row["CreateUserID"].ToString());
            }
            if (row["IsShowBtn"].ToString() != "")
            {
                model.IsShowBtn = int.Parse(row["IsShowBtn"].ToString());
            }
            if (row["IsShowWorkOrderBtn"].ToString() != "")
            {
                model.IsShowWorkOrderBtn = int.Parse(row["IsShowWorkOrderBtn"].ToString());
            }
            if (row["IsShowSendMsgBtn"].ToString() != "")
            {
                model.IsShowSendMsgBtn = int.Parse(row["IsShowSendMsgBtn"].ToString());
            }
            if (row["IsUsed"].ToString() != "")
            {
                model.IsUsed = int.Parse(row["IsUsed"].ToString());
            }
            if (row["IsShowQiCheTong"].ToString() != "")
            {
                model.IsShowQiCheTong = int.Parse(row["IsShowQiCheTong"].ToString());
            }
            if (row["IsShowSubmitOrder"].ToString() != "")
            {
                model.IsShowSubmitOrder = int.Parse(row["IsShowSubmitOrder"].ToString());
            }
            return(model);
        }
Example #3
0
        private void Generate(out string msg)
        {
            msg = "";

            int RecID = int.Parse(recid);

            Entities.TTable        ttableModel = new Entities.TTable();
            List <Entities.TField> fieldList   = new List <Entities.TField>();

            Entities.TPage tpageModel = BLL.TPage.Instance.GetTPage(RecID);
            if (tpageModel != null)
            {
                ttableModel = BLL.TTable.Instance.GetTTableByTTCode(tpageModel.TTCode);
                fieldList   = BLL.TField.Instance.GetTFieldListByTTCode(tpageModel.TTCode);
                if (fieldList.Count > 0)
                {
                    GenerateFields(tpageModel, ttableModel, fieldList, out msg);
                }
                else
                {
                    msg += "模板没有字段,不能生成";
                }
            }
            else
            {
                msg += "没有找到对应的模板信息";
            }
        }
Example #4
0
        private void DeleteTemplate(out string msg)
        {
            msg = string.Empty;
            int _recID;

            if (!int.TryParse(RequestRecID, out _recID))
            {
                msg = "result:'false',msg:'未找到主键,操作失败!'";
                return;
            }

            try
            {
                Entities.TPage model_tPage = BLL.TPage.Instance.GetTPage(_recID);
                BLL.TPage.Instance.Delete(_recID);
                if (!string.IsNullOrEmpty(model_tPage.GenTempletPath))
                {
                    //删除文件
                    string root     = BLL.Util.GetUploadWebRoot() + BLL.Util.GetUploadProject(BLL.Util.ProjectTypePath.Template, "\\");
                    string fullname = root + model_tPage.GenTempletPath;
                    File.Delete(fullname);
                }
            }
            catch
            {
                msg = "result:'false',msg:'执行出现异常,操作失败!'";
            }

            msg = "result:'true'";
        }
Example #5
0
        /// <summary>
        /// 保存excel文件
        /// </summary>
        /// <param name="tPage"></param>
        public void SaveExcelTemplate(Entities.TPage tPage, out string msg)
        {
            msg = string.Empty;
            // 获得数据
            if (ttCode == "")
            {
                return;
            }
            // 在服务器上生成Excel文件
            string FilePath = BLL.Util.GetUploadWebRoot() + BLL.Util.GetUploadProject(BLL.Util.ProjectTypePath.Template, "\\");
            string FileName = tPage.TPName + "_" + tPage.RecID;
            string fullname = FilePath + FileName + ".xls";

            if (!File.Exists(fullname))
            {
                BLL.Loger.Log4Net.Info("生成模板日志------------------------------------------开始");
                ArrayList array_TagRed = new ArrayList();
                DataTable dt           = getTemplateColumn(ttCode, out array_TagRed);

                Write(dt, fullname);
                BLL.Loger.Log4Net.Info("准备垃圾回收:");
                //垃圾回收
                GC.Collect();
                BLL.Loger.Log4Net.Info("垃圾回收结束");

                BLL.Loger.Log4Net.Info("生成模板日志------------------------------------------结束");
            }
        }
Example #6
0
        /// <summary>
        /// 根据TTCode获取实体
        /// </summary>
        /// <param name="p"></param>
        /// <returns></returns>
        public Entities.TPage GetTPageByTTCode(string ttcode)
        {
            Entities.TPage      tpageModel = new Entities.TPage();
            Entities.QueryTPage query      = new QueryTPage();
            query.TTCode = ttcode;
            int       totalCount = 0;
            DataTable dt         = BLL.TPage.Instance.GetTPage(query, "", 1, 999, out totalCount);

            if (dt != null && dt.Rows.Count > 0)
            {
                tpageModel = Dal.TPage.Instance.GetTPage(int.Parse(dt.Rows[0]["RecID"].ToString()));
            }
            return(tpageModel);
        }
Example #7
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(Entities.TPage model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",              SqlDbType.Int,          4),
                new SqlParameter("@TPName",             SqlDbType.NVarChar,   200),
                new SqlParameter("@BGID",               SqlDbType.Int,          4),
                new SqlParameter("@SCID",               SqlDbType.Int,          4),
                new SqlParameter("@TPRef",              SqlDbType.Text),
                new SqlParameter("@TTCode",             SqlDbType.NVarChar,    20),
                new SqlParameter("@TPContent",          SqlDbType.NText),
                new SqlParameter("@GenTempletPath",     SqlDbType.NVarChar,  1000),
                new SqlParameter("@Status",             SqlDbType.Int,          4),
                new SqlParameter("@Remark",             SqlDbType.NVarChar,  1000),
                new SqlParameter("@CreateTime",         SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",       SqlDbType.Int,          4),
                new SqlParameter("@TTName",             SqlDbType.NVarChar,    40),
                new SqlParameter("@IsShowBtn",          SqlDbType.Int,          4),
                new SqlParameter("@IsShowWorkOrderBtn", SqlDbType.Int,          4),
                new SqlParameter("@IsShowSendMsgBtn",   SqlDbType.Int,          4),
                new SqlParameter("@IsUsed",             SqlDbType.Int,          4),
                new SqlParameter("@IsShowQiCheTong",    SqlDbType.Int,          4),
                new SqlParameter("@IsShowSubmitOrder",  SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.TPName;
            parameters[2].Value     = model.BGID;
            parameters[3].Value     = model.SCID;
            parameters[4].Value     = model.TPRef;
            parameters[5].Value     = model.TTCode;
            parameters[6].Value     = model.TPContent;
            parameters[7].Value     = model.GenTempletPath;
            parameters[8].Value     = model.Status;
            parameters[9].Value     = model.Remark;
            parameters[10].Value    = model.CreateTime;
            parameters[11].Value    = model.CreateUserID;
            parameters[12].Value    = model.TTName;
            parameters[13].Value    = model.IsShowBtn;
            parameters[14].Value    = model.IsShowWorkOrderBtn;
            parameters[15].Value    = model.IsShowSendMsgBtn;
            parameters[16].Value    = model.IsUsed;
            parameters[17].Value    = model.IsShowQiCheTong;
            parameters[18].Value    = model.IsShowSubmitOrder;


            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_TPAGE_INSERT, parameters);
            return((int)parameters[0].Value);
        }
Example #8
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.TPage model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@RecID",              SqlDbType.Int,          4),
                new SqlParameter("@TPName",             SqlDbType.NVarChar,   200),
                new SqlParameter("@BGID",               SqlDbType.Int,          4),
                new SqlParameter("@SCID",               SqlDbType.Int,          4),
                new SqlParameter("@TPRef",              SqlDbType.Text),
                new SqlParameter("@TTCode",             SqlDbType.NVarChar,    20),
                new SqlParameter("@TPContent",          SqlDbType.NText),
                new SqlParameter("@GenTempletPath",     SqlDbType.NVarChar,  1000),
                new SqlParameter("@Status",             SqlDbType.Int,          4),
                new SqlParameter("@Remark",             SqlDbType.NVarChar,  1000),
                new SqlParameter("@CreateTime",         SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",       SqlDbType.Int,          4),
                new SqlParameter("@TTName",             SqlDbType.NVarChar,    40),
                new SqlParameter("@IsShowBtn",          SqlDbType.Int,          4),
                new SqlParameter("@IsShowWorkOrderBtn", SqlDbType.Int,          4),
                new SqlParameter("@IsShowSendMsgBtn",   SqlDbType.Int,          4),
                new SqlParameter("@IsUsed",             SqlDbType.Int,          4),
                new SqlParameter("@IsShowQiCheTong",    SqlDbType.Int,          4),
                new SqlParameter("@IsShowSubmitOrder",  SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.RecID;
            parameters[1].Value  = model.TPName;
            parameters[2].Value  = model.BGID;
            parameters[3].Value  = model.SCID;
            parameters[4].Value  = model.TPRef;
            parameters[5].Value  = model.TTCode;
            parameters[6].Value  = model.TPContent;
            parameters[7].Value  = model.GenTempletPath;
            parameters[8].Value  = model.Status;
            parameters[9].Value  = model.Remark;
            parameters[10].Value = model.CreateTime;
            parameters[11].Value = model.CreateUserID;
            parameters[12].Value = model.TTName;
            parameters[13].Value = model.IsShowBtn;
            parameters[14].Value = model.IsShowWorkOrderBtn;
            parameters[15].Value = model.IsShowSendMsgBtn;
            parameters[16].Value = model.IsUsed;
            parameters[17].Value = model.IsShowQiCheTong;
            parameters[18].Value = model.IsShowSubmitOrder;

            return(SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_TPAGE_UPDATE, parameters));
        }
Example #9
0
        //启用
        private void EnableTemplate(out string msg)
        {
            msg = string.Empty;
            int _recID;

            if (!int.TryParse(RequestRecID, out _recID))
            {
                msg = "result:'false',msg:'未找到主键,操作失败!'";
                return;
            }

            try
            {
                Entities.TPage model_tPage = BLL.TPage.Instance.GetTPage(_recID);
                model_tPage.IsUsed = 1;
                BLL.TPage.Instance.Update(model_tPage);
            }
            catch (Exception ex)
            {
                msg = "result:'false',msg:'执行出现异常,操作失败!'";
            }
            msg = "result:'true'";
        }
Example #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (AddType == "1")
                {
                    ExcelFilePath = "/ProjectManage/CrmCustImport/Templet/CRM客户导入模版.xls";
                    ExcelFileName = "导入客户ID";
                }
                else
                {
                    Entities.TPage tpageMode = BLL.TPage.Instance.GetTPageByTTCode(TTCode);
                    if (tpageMode != null)
                    {
                        string path = "/upload/" + BLL.Util.GetUploadProject(BLL.Util.ProjectTypePath.Template, "/");
                        RecID         = tpageMode.RecID;
                        ExcelFilePath = path + tpageMode.GenTempletPath;
                        ExcelFileName = tpageMode.TPName;
                    }
                }

                LoginUserID = BLL.Util.GetLoginUserID().ToString();
            }
        }
Example #11
0
        private void Submit(out string msg, int userID, out string returnTTCode)
        {
            msg          = "";
            returnTTCode = "";

            string       datainfoStr    = DataStr;
            TemplateInfo tempInfoData   = null;
            int          templateStatus = -1;//模板状态

            Entities.TPage         tpageModel    = new Entities.TPage();
            Entities.TTable        ttable        = new Entities.TTable();
            List <Entities.TField> editfieldList = new List <Entities.TField>();
            List <Entities.TField> addfieldList  = new List <Entities.TField>();

            Entities.TField fieldModel = new Entities.TField();

            List <Entities.TField> delFields = new List <Entities.TField>();

            tempInfoData = (TemplateInfo)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(datainfoStr, typeof(TemplateInfo));

            #region 验证数据

            CheckMsg(tempInfoData, out msg);

            if (msg != "")
            {
                return;
            }
            #endregion

            #region 准备数据

            if (tempInfoData.ttcode != "")
            {
                //编辑

                #region 模板信息

                tpageModel = BLL.TPage.Instance.GetTPageByTTCode(tempInfoData.ttcode);
                if (tpageModel != null)
                {
                    //状态
                    templateStatus = BLL.TPage.Instance.getStatus(tpageModel.RecID.ToString(), tpageModel.Status.ToString());

                    if (templateStatus != 0)
                    {
                        msg += "模板当前状态下不允许编辑";
                        return;
                    }

                    tpageModel.TPName             = tempInfoData.templateName;
                    tpageModel.BGID               = int.Parse(tempInfoData.BGID);
                    tpageModel.SCID               = int.Parse(tempInfoData.CID);
                    tpageModel.TPContent          = tempInfoData.templateDesc;
                    tpageModel.IsShowBtn          = int.Parse(tempInfoData.IsShowBtn);
                    tpageModel.IsShowWorkOrderBtn = int.Parse(tempInfoData.IsShowWorkOrderBtn);
                    tpageModel.IsShowSendMsgBtn   = int.Parse(tempInfoData.IsShowSendMsgBtn);
                    tpageModel.IsShowQiCheTong    = int.Parse(tempInfoData.IsShowQiCheTong);
                    tpageModel.IsShowSubmitOrder  = int.Parse(tempInfoData.IsShowSubmitOrder);
                }
                else
                {
                    msg += "没有找到相关模板信息";
                    return;
                }

                #endregion

                #region 自定义数据表

                ttable = BLL.TTable.Instance.GetTTableByTTCode(tempInfoData.ttcode);
                if (ttable != null)
                {
                    ttable.TTDesName = tempInfoData.templateName;
                }
                else
                {
                    msg += "没有找到相关的自定义表信息";
                    return;
                }

                #endregion

                #region 编辑字段
                editfieldList = BLL.TField.Instance.GetTFieldListByTTCode(tempInfoData.ttcode);
                List <FieldInfoData> updateFieldInfo = new List <FieldInfoData>();
                #region 新增的
                for (int i = tempInfoData.fieldListInfo.Length - 1; i >= 0; i--)
                {
                    if (tempInfoData.fieldListInfo[i].RecID == "")
                    {
                        //新增
                        fieldModel = GetOneFieldMode(userID, tempInfoData.fieldListInfo[i], tpageModel.TTCode, "");
                        addfieldList.Add(fieldModel);
                    }
                    else
                    {
                        //编辑的
                        updateFieldInfo.Add(tempInfoData.fieldListInfo[i]);
                    }
                }
                #endregion

                int existflog = 0;
                for (int i = editfieldList.Count - 1; i >= 0; i--)
                {
                    existflog = 0;
                    if (tempInfoData.fieldListInfo != null)
                    {
                        foreach (FieldInfoData field in updateFieldInfo)
                        {
                            if (field.RecID == editfieldList[i].RecID.ToString())
                            {
                                //编辑
                                editfieldList[i].TFDesName      = field.TFDesName;
                                editfieldList[i].TFDes          = field.TFDes;
                                editfieldList[i].TFInportIsNull = int.Parse(field.TFInportIsNull);
                                editfieldList[i].TFIsNull       = int.Parse(field.TFIsNull);
                                editfieldList[i].TFSortIndex    = int.Parse(field.TFSortIndex);
                                editfieldList[i].TFIsExportShow = int.Parse(field.TFIsExportShow);
                                editfieldList[i].TFIsListShow   = int.Parse(field.TFIsListShow);
                                editfieldList[i].TFValue        = field.TFValue;
                                editfieldList[i].TFCssName      = field.TFCssName;
                                existflog = 1;
                            }
                        }

                        // //在页面传来的对象中没有,是删除
                        if (existflog == 0)
                        {
                            //删除的
                            delFields.Add(editfieldList[i]);
                            editfieldList.RemoveAt(i);
                        }
                    }
                }
                #endregion
            }
            else
            {
                //新增
                #region 自定义数据表

                int maxID = BLL.TTable.Instance.GetMaxID();

                ttable.TTCode       = "t" + maxID;
                ttable.TTDesName    = tempInfoData.templateName;
                ttable.TTName       = "Tempt" + maxID;
                ttable.Status       = 0;
                ttable.CreateTime   = DateTime.Now;
                ttable.CreateUserID = userID;

                #endregion

                #region 模板表
                tpageModel.TPName             = tempInfoData.templateName;
                tpageModel.BGID               = int.Parse(tempInfoData.BGID);
                tpageModel.SCID               = int.Parse(tempInfoData.CID);
                tpageModel.TPRef              = "";
                tpageModel.TTCode             = ttable.TTCode;
                tpageModel.TPContent          = tempInfoData.templateDesc;
                tpageModel.GenTempletPath     = "";
                tpageModel.Status             = 0;
                tpageModel.Remark             = "";
                tpageModel.CreateTime         = DateTime.Now;
                tpageModel.CreateUserID       = userID;
                tpageModel.TTName             = ttable.TTName;
                tpageModel.IsShowBtn          = int.Parse(tempInfoData.IsShowBtn);
                tpageModel.IsShowWorkOrderBtn = int.Parse(tempInfoData.IsShowWorkOrderBtn);
                tpageModel.IsShowSendMsgBtn   = int.Parse(tempInfoData.IsShowSendMsgBtn);
                tpageModel.IsShowQiCheTong    = int.Parse(tempInfoData.IsShowQiCheTong);
                tpageModel.IsShowSubmitOrder  = int.Parse(tempInfoData.IsShowSubmitOrder);
                tpageModel.IsUsed             = -1;
                #endregion

                #region 字段

                if (tempInfoData.fieldListInfo != null)
                {
                    foreach (FieldInfoData item in tempInfoData.fieldListInfo)
                    {
                        string ttCode = ttable.TTCode;

                        fieldModel = GetOneFieldMode(userID, item, ttCode, "");

                        addfieldList.Add(fieldModel);
                    }
                }

                #endregion
            }

            #endregion

            #region 提交事务

            string        connectionstrings = ConfigurationUtil.GetAppSettingValue("ConnectionStrings_CC");
            SqlConnection connection        = new SqlConnection(connectionstrings);
            connection.Open();
            SqlTransaction tran = connection.BeginTransaction("SampleTransaction");

            try
            {
                if (tempInfoData.ttcode == "")
                {
                    //新增

                    BLL.TPage.Instance.Insert(tran, tpageModel);

                    BLL.TTable.Instance.Insert(tran, ttable);

                    //新增的字段
                    foreach (Entities.TField item in addfieldList)
                    {
                        BLL.TField.Instance.Insert(tran, item);
                    }

                    returnTTCode = tpageModel.TTCode;
                }
                else
                {
                    //编辑

                    BLL.TPage.Instance.Update(tran, tpageModel);

                    BLL.TTable.Instance.Update(tran, ttable);

                    //编辑的字段
                    foreach (Entities.TField item in editfieldList)
                    {
                        BLL.TField.Instance.Update(tran, item);
                    }

                    //新增的字段
                    foreach (Entities.TField item in addfieldList)
                    {
                        BLL.TField.Instance.Insert(tran, item);

                        #region 如果已经生成模板,添加物理表的字段(修改为:模板生成了,还可以修改,⊙﹏⊙b汗)

                        if (templateStatus == 1)
                        {
                            try
                            {
                                List <string> addNames = GetRealFieldName(item);

                                foreach (string name in addNames)
                                {
                                    BLL.TField.Instance.AddColumn(ttable.TTName, name, item.TTypeID.ToString());
                                }
                            }
                            catch (Exception ex)
                            {
                                msg += "添加数据表字段失败!<br>";
                            }
                        }

                        #endregion
                    }

                    //删除的字段

                    foreach (Entities.TField item in delFields)
                    {
                        BLL.TField.Instance.Delete(item.RecID);

                        #region 如果已经生成模板,删除物理表的字段

                        if (templateStatus == 1)
                        {
                            try
                            {
                                List <string> delNames = GetRealFieldName(item);

                                foreach (string name in delNames)
                                {
                                    BLL.TField.Instance.DelColumn(ttable.TTName, name);
                                }
                            }
                            catch (Exception ex)
                            {
                                msg += "删除数据表字段失败!<br>";
                            }
                        }

                        #endregion
                    }

                    returnTTCode = tpageModel.TTCode;
                }


                tran.Commit();
            }
            catch (Exception ex)
            {
                if (tran.Connection != null)
                {
                    tran.Rollback();
                }
                msg = ex.Message.ToString();
            }
            finally
            {
                connection.Close();
            }

            #endregion
        }
Example #12
0
        /// <summary>
        /// 生成字段
        /// </summary>
        /// <param name="tpageModel"></param>
        /// <param name="ttableModel"></param>
        /// <param name="fieldList"></param>
        /// <param name="msg"></param>
        private void GenerateFields(Entities.TPage tpageModel, Entities.TTable ttableModel, List <Entities.TField> fieldList, out string msg)
        {
            msg = "";
            #region  除模板文件
            try
            {
                string root     = BLL.Util.GetUploadWebRoot() + BLL.Util.GetUploadProject(BLL.Util.ProjectTypePath.Template, "\\");
                string fullname = root + tpageModel.TPName + "_" + tpageModel.RecID + ".xls";
                if (File.Exists(fullname))
                {
                    File.Delete(fullname);
                }
            }
            catch (Exception ex)
            {
                msg = "删除模板文件出现异常:" + ex.Message;
            }

            #endregion

            #region 创建表
            string sqlStr = CreateSql(ttableModel, fieldList);
            BLL.TTable.Instance.CreateTable(sqlStr, out msg);
            #endregion

            #region 生成Excel文件
            if (msg != string.Empty)
            {
                return;
            }
            SaveExcelTemplate(tpageModel, out msg);
            #endregion

            #region 修改模板的状态和路径
            BLL.Util.InsertUserLog("【生成模板结束】createFileIsOk为" + createFileIsOk + ",msg为" + msg);
            if (!createFileIsOk)
            {
                BLL.Util.InsertUserLog("【生成模板失败】createFileIsOk为False,准备删除【" + ttableModel.TTName + "】模板表");
                //生成模板失败,则删除刚才创建的表
                string dropSql = " DROP Table " + ttableModel.TTName;
                string dropMsg = string.Empty;
                try
                {
                    BLL.TTable.Instance.CreateTable(dropSql, out dropMsg);
                    //记录日志
                    BLL.Util.InsertUserLog("【生成模板失败】【删除】刚创建的表【" + ttableModel.TTName + "】【删除模板表成功】");
                }
                catch (Exception ex)
                {
                    //记录日志
                    BLL.Util.InsertUserLog("【生成模板失败】【删除】刚创建的表【" + ttableModel.TTName + "】【删除模板表失败】,异常信息:" + ex.Message);
                }
                return;
            }

            //修改TPage表的IsUsed“是否可用”字段:修改成1:启用
            //add lxw 13.12.16
            tpageModel.IsUsed = 1;
            tpageModel.Status = 1;
            //更新路径到模板表
            tpageModel.GenTempletPath = tpageModel.TPName + "_" + tpageModel.RecID + ".xls";
            BLL.TPage.Instance.Update(tpageModel);
            #endregion
        }
Example #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(OtherTaskID))
                {
                    Entities.OtherTaskInfo model = BLL.OtherTaskInfo.Instance.GetOtherTaskInfo(OtherTaskID);
                    BlackWhiteList = Convert.ToInt16(Entities.NotEstablishReason.N05_免打扰屏蔽).ToString();
                    if (model != null)
                    {
                        UserID = BLL.Util.GetLoginUserID().ToString();

                        if (IsAutoCall == "true")
                        {
                            //重新分配坐席
                            BLL.ProjectTask_Employee.Instance.DeleteByIDs("'" + OtherTaskID + "'");
                            //新建坐席数据
                            Entities.ProjectTask_Employee info = new Entities.ProjectTask_Employee();
                            info.PTID         = OtherTaskID;
                            info.UserID       = int.Parse(UserID);
                            info.Status       = 0;
                            info.CreateTime   = DateTime.Now;
                            info.CreateUserID = int.Parse(UserID);
                            BLL.ProjectTask_Employee.Instance.Add(info);
                            //修改任务状态=处理中
                            BLL.OtherTaskInfo.Instance.UpdateTaskStatus(info.PTID, Entities.OtheTaskStatus.Processing, Entities.EnumProjectTaskOperationStatus.TaskAllot, "分配", info.UserID.Value);
                            //修改实体类中属性
                            model.TaskStatus = (Int32)Entities.OtheTaskStatus.Processing;
                        }

                        if (model.TaskStatus == (Int32)Entities.OtheTaskStatus.Processed)
                        {
                            Response.Write(@"<script language='javascript'>javascript:alert('该任务已处理完毕!');try {
                                                                 window.external.MethodScript('/browsercontrol/closepage');
                                                            } catch (e) {
                                                                window.opener = null; window.open('', '_self'); window.close();
                                                            };</script>");
                        }
                        else if (model.TaskStatus == (Int32)Entities.OtheTaskStatus.StopTask)
                        {
                            Response.Write(@"<script language='javascript'>javascript:alert('该任务已结束!');try {
                                                                 window.external.MethodScript('/browsercontrol/closepage');
                                                            } catch (e) {
                                                                window.opener = null; window.open('', '_self'); window.close();
                                                            };</script>");
                        }
                        else if (model.TaskStatus == (Int32)Entities.OtheTaskStatus.Unallocated)
                        {
                            Response.Write(@"<script language='javascript'>javascript:alert('该任务未分配处理人!');try {
                                                                 window.external.MethodScript('/browsercontrol/closepage');
                                                            } catch (e) {
                                                                window.opener = null; window.open('', '_self'); window.close();
                                                            };</script>");
                        }
                        else
                        {
                            DataTable dtEmployee = BLL.ProjectTask_Employee.Instance.GetProjectTask_Employee(OtherTaskID);
                            if (dtEmployee != null && dtEmployee.Rows.Count > 0)
                            {
                                if (BLL.Util.GetLoginUserID().ToString() == dtEmployee.Rows[0]["userid"].ToString())
                                {
                                    OtherTaskEdit1.RequestTaskID = OtherTaskID;
                                }
                                else
                                {
                                    Response.Write(@"<script language='javascript'>javascript:alert('您没有该任务的处理权限!');try {
                                                                     window.external.MethodScript('/browsercontrol/closepage');
                                                                } catch (e) {
                                                                    window.opener = null; window.open('', '_self'); window.close();
                                                                };</script>");
                                }
                            }
                            else
                            {
                                Response.Write(@"<script language='javascript'>javascript:alert('该任务未分配处理人!');try {
                                                                     window.external.MethodScript('/browsercontrol/closepage');
                                                                } catch (e) {
                                                                    window.opener = null; window.open('', '_self'); window.close();
                                                                };</script>");
                            }
                        }


                        Entities.ProjectInfo projectModel = BLL.ProjectInfo.Instance.GetProjectInfo((long)model.ProjectID);
                        if (projectModel != null)
                        {
                            BGID = projectModel.BGID.ToString();
                            SCID = projectModel.PCatageID.ToString();
                            Entities.TPage pageModel = BLL.TPage.Instance.GetTPageByTTCode(projectModel.TTCode);
                            if (pageModel.IsShowSubmitOrder.ToString() == "1")
                            {
                                IsShowSubmitOrder = true;
                            }
                        }
                    }
                    else
                    {
                        Response.Write(@"<script language='javascript'>javascript:alert('该任务不存在。');try {
                                                         window.external.MethodScript('/browsercontrol/closepage');
                                                    } catch (e) {
                                                        window.opener = null; window.open('', '_self'); window.close();
                                                    };</script>");
                    }
                }
            }
        }
Example #14
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SqlTransaction sqltran, Entities.TPage model)
 {
     return(Dal.TPage.Instance.Update(sqltran, model));
 }
Example #15
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.TPage model)
 {
     return(Dal.TPage.Instance.Update(model));
 }
Example #16
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Insert(Entities.TPage model)
 {
     return(Dal.TPage.Instance.Insert(model));
 }