Exemple #1
0
        public static Result ExceptionTrack(string personId, string BillNo, DateTime PlanEndTime, string Solution, int DealwithState, string userId)
        {
            Result        res      = new Result();
            LibBcfData    bcfData  = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("com.AbnormalTrace");
            LibEntryParam param    = new LibEntryParam();
            DataSet       dataSet  = bcfData.AddNew(param);
            DataTable     masterDt = dataSet.Tables[0];

            masterDt.BeginLoadData();
            DataRow masterRow = masterDt.Rows[0];

            try
            {
                masterRow.BeginEdit();
                try
                {
                    masterRow["TYPEID"]           = "P001";
                    masterRow["FROMBILLNO"]       = BillNo;
                    masterRow["PLANENDTIME"]      = LibDateUtils.DateTimeToLibDateTime(PlanEndTime);
                    masterRow["SOLUTION"]         = Solution;
                    masterRow["DEALWITHSTATE"]    = DealwithState;
                    masterRow["DEALWITHPERSONID"] = personId;
                }
                catch
                {
                    throw;
                }
                finally
                {
                    masterRow.EndEdit();
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                masterDt.EndLoadData();
            }
            bcfData.InnerSave(BillAction.AddNew, null, dataSet);
            if (bcfData.ManagerMessage.IsThrow)
            {
                res.Message     = "数据有误";
                res.ReturnValue = false;
            }
            else
            {
                res.ReturnValue = true;
                //Service.PushMessage(userId, PushType.Message);
            }
            return(res);
        }
Exemple #2
0
        public string Register(RegisterInfo info)
        {
            string        error      = string.Empty;
            LibDataAccess dataAccess = new LibDataAccess();
            string        userId     = LibSysUtils.ToString(dataAccess.ExecuteScalar(string.Format("select USERID from AXPUSER where USERID={0}",
                                                                                                   LibStringBuilder.GetQuotString(info.inputId))));

            if (string.IsNullOrEmpty(userId))
            {
                string personId = LibSysUtils.ToString(dataAccess.ExecuteScalar(string.Format("select PERSONID from COMPERSON where PERSONNAME={0} and DEPTID={1}",
                                                                                              LibStringBuilder.GetQuotString(info.inputName), LibStringBuilder.GetQuotString(info.inputDept))));
                //如果遇到同部门同名的情况。建议客户手动创建人员主数据。
                if (string.IsNullOrEmpty(personId))
                {
                    LibBcfData bcfData   = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("com.Person");
                    DataSet    dataSet   = bcfData.AddNew(null);
                    DataRow    masterRow = dataSet.Tables[0].Rows[0];
                    masterRow.BeginEdit();
                    try
                    {
                        if (string.IsNullOrEmpty(LibSysUtils.ToString(masterRow["PERSONID"])))
                        {
                            masterRow["PERSONID"] = personId = LibCommUtils.GetInternalId().ToString();
                        }
                        masterRow["PERSONNAME"] = info.inputName;
                        masterRow["GENDER"]     = info.gender;
                        masterRow["DEPTID"]     = info.inputDept;
                        masterRow["MAIL"]       = info.inputEmail;
                        masterRow["PHONENO"]    = info.inputPhone;
                    }
                    finally
                    {
                        masterRow.EndEdit();
                    }
                    dataSet  = bcfData.InnerSave(BillAction.AddNew, new object[] { personId }, dataSet);
                    personId = LibSysUtils.ToString(dataSet.Tables[0].Rows[0]["PERSONID"]);
                }
                if (!string.IsNullOrEmpty(personId))
                {
                    string sql = string.Format("insert into AXPUSER(USERID,USERPASSWORD,PERSONID,ISUSE) values({0},{1},{2},0)",
                                               LibStringBuilder.GetQuotString(info.inputId), LibStringBuilder.GetQuotString(info.inputPassword1),
                                               LibStringBuilder.GetQuotString(personId));
                    dataAccess.ExecuteNonQuery(sql);
                }
            }
            else
            {
                error = "账号已注册";
            }
            return(error);
        }
Exemple #3
0
        public UpLoadFileResult UpLoadFile1(HttpPostedFile file, string progId = "")
        {
            UpLoadFileResult upLoadFileResult = new UpLoadFileResult();

            bool isLocalHost = true;

            string fileName = LibDateUtils.Now().Ticks.ToString();

            fileName = file.FileName.Replace(file.FileName.Substring(0, file.FileName.LastIndexOf('.')), fileName);
            string filePath = Path.Combine(EnvProvider.Default.RuningPath, "TempData", "ImportData", fileName);
            string url      = Path.Combine("\\TempData", "ImportData", fileName);

            #region 对应实体图片路径
            if (!string.IsNullOrEmpty(progId))
            {
                string  sql     = string.Format(" SELECT Url,LocalHost FROM ComImagePath WHERE Progid='{0}' ", progId);
                DataSet dataSet = new LibDataAccess().ExecuteDataSet(sql);
                if (dataSet != null && dataSet.Tables.Count > 0 && dataSet.Tables[0].Rows.Count > 0)
                {
                    DataRow dr = dataSet.Tables[0].Rows[0];
                    isLocalHost = LibSysUtils.ToBoolean(dr["LocalHost"]);
                    url         = LibSysUtils.Combine(LibSysUtils.ToString(dr["Url"]), fileName);
                    filePath    = LibSysUtils.Combine(EnvProvider.Default.RuningPath, url);
                }
            }
            #endregion

            #region 新增图片实体
            LibEntryParam entryParam = new LibEntryParam();

            DataSet    dataset = null;
            LibBcfData bcfData = (LibBcfData)LibBcfSystem.Default.GetBcfInstance("KanTime.Picture");
            dataset = bcfData.AddNew(entryParam);

            #region 填充数据
            dataset.EnforceConstraints = false;
            try
            {
                #region  表头
                DataRow masterRow = dataset.Tables[0].Rows[0];
                masterRow.BeginEdit();
                masterRow["Name"] = fileName;
                masterRow["Url"]  = url;
                masterRow.EndEdit();
                #endregion

                #region 明细
                //dataset.Tables[1].BeginLoadData();
                //dataset.Tables[1].EndLoadData();
                #endregion
            }
            finally
            {
                dataset.EnforceConstraints = true;
            }
            dataset = bcfData.InnerSave(BillAction.AddNew, null, dataset);
            if (bcfData.ManagerMessage.IsThrow)
            {
                StringBuilder strMsg = new StringBuilder();
                foreach (var item in bcfData.ManagerMessage.MessageList)
                {
                    strMsg.AppendFormat("{0}", item.Message);
                }
                throw new Exception(strMsg.ToString());
            }
            #endregion

            #endregion

            file.SaveAs(filePath);

            #region 返回本机或外网地址
            if (isLocalHost)
            {
                upLoadFileResult.FileName = url;
            }
            else
            {
                upLoadFileResult.FileName = LibSysUtils.Combine(EnvProvider.Default.UploadHostName, url);
            }
            #endregion

            upLoadFileResult.success = true;
            return(upLoadFileResult);
        }