Пример #1
0
        //获取文件类型
        public static JObject GetSelectAreaList(string sid, string ProjectKeyword, string page, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                page = page ?? "1";
                string limit = "50";
                page = (Convert.ToInt32(page) - 1).ToString();
                int CurPage = Convert.ToInt32(page);

                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                Filter = Filter.Trim().ToLower();

                string curAreaCode = "";

                curAreaCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                if (string.IsNullOrEmpty(curAreaCode))
                {
                    reJo.msg = "获取项目来源失败!";
                    return(reJo.Value);
                }

                JArray jaData = new JArray();

                #region 添加厂房
                //获取所有参建单位
                List <DictData> dictDataList = dbsource.GetDictDataList("Factory");
                List <DictData> resultDDList = new List <DictData>();
                ////按代码排序
                //dictDataList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_Code.CompareTo(y.O_Code);
                //});


                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 &&
                        data6.O_Desc.ToLower().IndexOf(Filter) < 0 &&
                        data6.O_sValue1.ToLower().IndexOf(Filter) < 0
                        )
                    {
                        continue;
                    }

                    if (data6.O_sValue2 != curAreaCode)
                    {
                        continue;
                    }
                    resultDDList.Add(data6);
                }

                #endregion


                reJo.total = resultDDList.Count();
                int ShowNum = 50;

                List <DictData> resDDList = resultDDList.Skip(CurPage * ShowNum).Take(ShowNum).ToList();

                foreach (DictData data6 in resDDList)
                {
                    //if (data6.O_sValue1 == curAreaCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("areaType", "厂房"),
                            new JProperty("areaId", data6.O_ID.ToString()),
                            new JProperty("areaCode", data6.O_Code),
                            new JProperty("areaDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }


                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curAreaCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("areaType", "项目部门"),
                //            new JProperty("areaId", data6.O_ID.ToString()),
                //            new JProperty("areaCode", data6.O_Code),
                //            new JProperty("areaDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                ////获取所有项目部门(不区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("Communication");

                ////按代码排序
                //departDdList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_sValue1.CompareTo(y.O_sValue1);
                //});

                //foreach (DictData data6 in departDdList)
                //{
                //    //判断是否符合过滤条件
                //    if (!string.IsNullOrEmpty(Filter) &&
                //        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                //    {
                //        continue;
                //    }

                //    //if (data6.O_sValue1 == curAreaCode)
                //    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("areaType", "项目部门"),
                //            new JProperty("areaId", data6.O_ID.ToString()),
                //            new JProperty("areaCode", data6.O_sValue1),
                //            new JProperty("areaDesc", data6.O_Desc)
                //            );
                //        jaData.Add(joData);
                //    }
                //}

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #2
0
        public static JObject GetSelectUnitList(string sid, string ProjectKeyword, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                Filter = Filter.Trim().ToLower();

                string curUnitCode = "";

                curUnitCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                if (string.IsNullOrEmpty(curUnitCode))
                {
                    reJo.msg = "获取项目来源失败!";
                    return(reJo.Value);
                }

                JArray jaData = new JArray();


                #region 获取项目的通信代码
                AttrData data;
                if ((data = prjProject.GetAttrDataByKeyWord("RPO_ONSHORE")) != null)
                {
                    string strData = data.ToString;
                    if (!string.IsNullOrEmpty(strData))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "通信代码"),
                            new JProperty("unitId", data.DefnID),
                            new JProperty("unitCode", data.ToString),
                            new JProperty("unitDesc", "OnShore")
                            );
                        jaData.Add(joData);
                    }
                }
                if ((data = prjProject.GetAttrDataByKeyWord("RPO_OFFSHORE")) != null)
                {
                    string strData = data.ToString;
                    if (!string.IsNullOrEmpty(strData))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "通信代码"),
                            new JProperty("unitId", data.DefnID),
                            new JProperty("unitCode", data.ToString),
                            new JProperty("unitDesc", "OffShore")
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion
                #region 获取所有参建单位
                //获取所有参建单位
                List <DictData> tmpDataList = dbsource.GetDictDataList("Unit");

                List <DictData> dictDataList = new List <DictData>();

                //过滤不是当前项目的参建单位,提高排序速度
                foreach (DictData data6 in tmpDataList)
                {
                    //判断是否符合过滤条件
                    if (data6.O_sValue1 == curUnitCode)
                    {
                        dictDataList.Add(data6);
                    }
                }
                //按代码排序
                dictDataList.Sort(delegate(DictData x, DictData y)
                {
                    return(x.O_Code.CompareTo(y.O_Code));
                });

                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    if (data6.O_sValue1 == curUnitCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "参建单位"),
                            new JProperty("unitId", data6.O_ID.ToString()),
                            new JProperty("unitCode", data6.O_Code),
                            new JProperty("unitDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion



                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curUnitCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("unitType", "项目部门"),
                //            new JProperty("unitId", data6.O_ID.ToString()),
                //            new JProperty("unitCode", data6.O_Code),
                //            new JProperty("unitDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                #region 获取所有项目部门(不区分项目)
                //获取所有项目部门(不区分项目)
                List <DictData> departDdList = dbsource.GetDictDataList("Communication");

                //按代码排序
                departDdList.Sort(delegate(DictData x, DictData y)
                {
                    return(x.O_sValue1.CompareTo(y.O_sValue1));
                });

                foreach (DictData data6 in departDdList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    //if (data6.O_sValue1 == curUnitCode)
                    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                    {
                        JObject joData = new JObject(
                            new JProperty("unitType", "项目部门"),
                            new JProperty("unitId", data6.O_ID.ToString()),
                            new JProperty("unitCode", data6.O_sValue1),
                            new JProperty("unitDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }
                #endregion

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #3
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateCompanyProject(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                //获取所有厂家信息
                TempDefn mTempDefn = GetTempDefn(dbsource, "COM_UNIT");
                if (mTempDefn == null)
                {
                    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                    return(reJo.Value);
                }

                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyCode = "", strCompanyDesc = "", companyType = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "companyType":
                        companyType = strValue;
                        break;
                    }
                }
                #endregion

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "新建参建单位目录失败,请输入单位编码!";
                    return(reJo.Value);
                }

                Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                if (project == null)
                {
                    reJo.msg = "新建参建单位目录失败,请联系管理员!";
                    return(reJo.Value);
                }

                #region 添加文控角色到新建立的参建单位目录
                //增加附加属性
                try
                {
                    string secretarilMan = "";
                    if (companyType == "项目部门")
                    {
                        //获取所有项目部门(不区分项目)
                        List <DictData> departDdList = dbsource.GetDictDataList("Communication");

                        foreach (DictData data6 in departDdList)
                        {
                            if (data6.O_sValue1.Trim() != strCompanyCode)
                            {
                                continue;
                            }
                            if (!string.IsNullOrEmpty(data6.O_sValue4.Trim()))
                            {
                                secretarilMan = data6.O_sValue4.Trim();
                            }
                        }
                    }
                    else if (companyType == "参建单位")
                    {
                        Project rootProj = CommonFunction.getParentProjectByTempDefn(project, "HXNY_DOCUMENTSYSTEM");
                        if (rootProj != null)
                        {
                            string rootProjCode = rootProj.Code;

                            List <DictData> departDdList = dbsource.GetDictDataList("Unit");

                            foreach (DictData data6 in departDdList)
                            {
                                if (string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                                {
                                    continue;
                                }
                                if (data6.O_sValue1.Trim() != rootProjCode)
                                {
                                    continue;
                                }
                                if (data6.O_Code.Trim() != strCompanyCode)
                                {
                                    continue;
                                }
                                if (!string.IsNullOrEmpty(data6.O_sValue3.Trim()))
                                {
                                    secretarilMan = data6.O_sValue3.Trim();
                                }
                            }
                        }
                    }

                    project.GetAttrDataByKeyWord("UN_SECRETAARECTOR").SetCodeDesc(secretarilMan);    //文控
                    project.AttrDataList.SaveData();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                    reJo.msg = "获取厂家模板失败,请联系管理员!";
                    return(reJo.Value);
                }
                #endregion

                reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #4
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EDITSystem(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strSystemId = "", strSystemCode = "", strSystemDesc = "",
                       strSystemEngDesc = "", strSystemChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "systemId":
                        strSystemId = strValue;
                        break;

                    case "systemCode":
                        strSystemCode = strValue;
                        break;

                    case "systemDesc":
                        strSystemDesc = strValue;
                        break;

                    case "systemEngDesc":
                        strSystemEngDesc = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strSystemCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strSystemDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }
                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }


                int systemId = Convert.ToInt32(strSystemId);
                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;


                JArray  jaData   = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode &&
                        data6.O_Code == strSystemCode && data6.O_ID != systemId)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }

                #region 添加到数据字典

                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == systemId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "参建单位ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                dictData.O_Code    = strSystemCode;
                dictData.O_Desc    = strSystemDesc;
                dictData.O_sValue2 = strProjCode;
                dictData.O_sValue1 = strSystemEngDesc;
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                #endregion

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #5
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateSystem(string sid, string ProjectKeyword, string systemAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(systemAttrJson);

                string strSystemCode = "", strSystemDesc = "",
                       strSystemEngDesc = "", strSystemChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "systemCode":
                        strSystemCode = strValue;
                        break;

                    case "systemDesc":
                        strSystemDesc = strValue;
                        break;

                    case "systemEngDesc":
                        strSystemEngDesc = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strSystemCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strSystemDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }

                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                JArray  jaData   = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode && data6.O_Code == strSystemCode)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                string format = "insert CDMS_DictData (" +
                                "o_parentno,o_datatype,o_ikey,o_skey,o_Code,o_Desc,o_sValue1,o_sValue2,o_sValue3,o_sValue4,o_sValue5,o_iValue1 ,o_iValue2)" +
                                " values ({0},{1},{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',{11},{12}" + ")";
                //0,2,0,'Unit','"+strSystemCode+"','"+strSystemDesc+"','"+strProjCode+ "','','','','',0,0
                format = string.Format(format, new object[] {
                    0, 2, 0, "System", strSystemCode, strSystemDesc, strSystemEngDesc, strProjCode, "", "", "", 0, 0
                });
                dbsource.DBExecuteSQL(format);

                DBSourceController.refreshDBSource(sid);

                #endregion


                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #6
0
        public static JObject GetSelectProfessionList(string sid, string ProjectKeyword, string Filter)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                //Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                //if (prjProject == null)
                //{
                //    reJo.msg = "获取项目目录失败!";
                //    return reJo.Value;
                //}

                Filter = Filter.Trim().ToLower();

                //string curProfessionCode = "";

                //curProfessionCode = prjProject.Code;//.GetValueByKeyWord("PRO_COMPANY");
                //if (string.IsNullOrEmpty(curProfessionCode))
                //{
                //    reJo.msg = "获取项目来源失败!";
                //    return reJo.Value;
                //}

                JArray jaData = new JArray();
                //获取所有参建单位
                List <DictData> dictDataList = dbsource.GetDictDataList("Profession");

                ////按代码排序
                //dictDataList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_Code.CompareTo(y.O_Code);
                //});

                foreach (DictData data6 in dictDataList)
                {
                    //判断是否符合过滤条件
                    if (!string.IsNullOrEmpty(Filter) &&
                        data6.O_Code.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                    {
                        continue;
                    }

                    //if (data6.O_sValue1 == curProfessionCode)
                    {
                        JObject joData = new JObject(
                            new JProperty("professionType", "专业"),
                            new JProperty("professionId", data6.O_ID.ToString()),
                            new JProperty("professionCode", data6.O_Code),
                            new JProperty("professionDesc", data6.O_Desc)
                            );
                        jaData.Add(joData);
                    }
                }



                //获取所有项目部门(区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("DeparDate");

                //foreach (DictData data6 in departDdList)
                //{
                //    //if (data6.O_sValue1 == curProfessionCode)
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("professionType", "项目部门"),
                //            new JProperty("professionId", data6.O_ID.ToString()),
                //            new JProperty("professionCode", data6.O_Code),
                //            new JProperty("professionDesc", data6.O_Desc)
                //            );
                //          jaData.Add(joData);
                //    }
                //}

                ////获取所有项目部门(不区分项目)
                //List<DictData> departDdList = dbsource.GetDictDataList("Communication");

                ////按代码排序
                //departDdList.Sort(delegate (DictData x, DictData y)
                //{
                //    return x.O_sValue1.CompareTo(y.O_sValue1);
                //});

                //foreach (DictData data6 in departDdList)
                //{
                //    //判断是否符合过滤条件
                //    if (!string.IsNullOrEmpty(Filter) &&
                //        data6.O_sValue1.ToLower().IndexOf(Filter) < 0 && data6.O_Desc.ToLower().IndexOf(Filter) < 0)
                //    {
                //        continue;
                //    }

                //    //if (data6.O_sValue1 == curProfessionCode)
                //    if (!string.IsNullOrEmpty(data6.O_sValue1.Trim()))
                //    {
                //        JObject joData = new JObject(
                //            new JProperty("professionType", "项目部门"),
                //            new JProperty("professionId", data6.O_ID.ToString()),
                //            new JProperty("professionCode", data6.O_sValue1),
                //            new JProperty("professionDesc", data6.O_Desc)
                //            );
                //        jaData.Add(joData);
                //    }
                //}

                reJo.data    = jaData;
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #7
0
        /// <summary>
        /// 新建厂家资料目录时,获取默认值
        /// </summary>
        /// <param name="sid"></param>
        /// <returns></returns>
        public static JObject GetEditSystemDefault(string sid, string ProjectKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;
                string strProjDesc = prjProject.Description;

                JArray  jaSystem = new JArray();
                JObject joSystem = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("System");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue2) && data6.O_sValue2 == strProjCode)
                    {
                        joSystem = new JObject(
                            new JProperty("systemId", data6.O_ID.ToString()),
                            new JProperty("systemCode", data6.O_Code),
                            new JProperty("systemDesc", data6.O_Desc),
                            new JProperty("systemEngDesc", data6.O_sValue1)
                            );
                        jaSystem.Add(joSystem);
                    }
                }


                reJo.data = new JArray(
                    new JObject(new JProperty("projectCode", strProjCode),
                                new JProperty("projectDesc", strProjDesc),
                                new JProperty("SystemList", jaSystem)));
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #8
0
        /// <summary>
        /// 获取创建认质认价表单的默认配置
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="ProjectKeyword"></param>
        /// <returns></returns>
        public static JObject GetDraftRecognitionDefault(string sid, string ProjectKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_Project = dbsource.GetProjectByKeyWord(ProjectKeyword);

                //定位到发文目录
                //m_Project = LocalProject(m_Project);

                if (m_Project == null)
                {
                    reJo.msg = "参数错误!文件夹不存在!";
                    return(reJo.Value);
                }

                //获取项目号
                string RootProjectCode = m_Project.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_CODE");
                if (RootProjectCode == null)
                {
                    RootProjectCode = "";
                }

                //设计阶段目录
                Project designphase = CommonFunction.GetDesign(m_Project);

                //获取发文单位列表
                JObject joSendCompany = new JObject();

                //获取收文单位列表
                JObject joRecCompany = new JObject();

                //Dictionary<string, string> dictionary = new Dictionary<string, string>();
                List <DictData> dictDataList = dbsource.GetDictDataList("Communication");
                //[o_Code]:英文描述,[o_Desc]:中文描述,[o_sValue1]:通信代码
                //string str3 = m_Project.ExcuteDefnExpression("$(DESIGNPROJECT_CODE)")[0];
                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1))
                    {
                        joRecCompany.Add(new JProperty(data6.O_sValue1, data6.O_Desc));
                        joSendCompany.Add(new JProperty(data6.O_sValue1, data6.O_Desc));
                    }
                }

                //获取根目录
                Project rootProj   = CommonFunction.getParentProjectByTempDefn(m_Project, "HXNY_DOCUMENTSYSTEM");
                string  strCompany = "";
                if (rootProj != null)
                {
                    strCompany = rootProj.GetAttrDataByKeyWord("PRO_COMPANY").ToString;
                }


                //string DocNumber = getDocNumber(m_Project, companyList[0].ToString);//设置编号

                string DocNumber = "";// 设置编号

                JObject joData = new JObject(
                    new JProperty("RootProjectCode", RootProjectCode),
                    new JProperty("DocNumber", DocNumber),
                    new JProperty("RecCompanyList", joRecCompany),
                    new JProperty("SendCompanyList", joSendCompany),
                    new JProperty("SourceCompany", strCompany)
                    );


                reJo.data    = new JArray(joData);
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
Пример #9
0
        /// <summary>
        /// 获取创建收文单表单的默认配置
        /// </summary>
        /// <param name="sid"></param>
        /// <param name="DocKeyword"></param>
        /// <returns></returns>
        public static JObject GetReceiveDocumentDefault(string sid, string DocKeyword)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Doc m_Doc = dbsource.GetDocByKeyWord(DocKeyword);

                if (m_Doc == null)
                {
                    reJo.msg = "参数错误!文档不存在!";
                    return(reJo.Value);
                }

                //项目代码
                string RootProjectCode = m_Doc.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_CODE");

                //项目名称
                string RootProjectDesc = m_Doc.GetValueByKeyWord("HXNY_DOCUMENTSYSTEM_DESC");

                //来文单位
                string CommUnit     = "";
                string CommUnitCode = "";
                if (m_Doc.Project.TempDefn.KeyWord == "COM_UNIT")
                {
                    CommUnit     = m_Doc.Project.Description;
                    CommUnitCode = m_Doc.Project.Code;
                }


                Project recTypeProject = CommonFunction.getParentProjectByTempDefn(m_Doc.Project, "COM_COMTYPE");

                #region 获取收文编号
                string recType = "";
                if (recTypeProject.Code == "信函" || recTypeProject.Description == "信函")
                {
                    recType = "LET";
                }
                else if (recTypeProject.Code == "文件传递单" || recTypeProject.Description == "文件传递单")
                {
                    recType = "TRA";
                }

                Project recUnitProject = CommonFunction.getParentProjectByTempDefn(m_Doc.Project, "HXNY_DOCUMENTSYSTEM");

                string recUnitCode = "";
                if (recUnitProject != null)
                {
                    recUnitCode = recUnitProject.GetValueByKeyWord("PRO_COMPANY");
                }

                string ONShoreCommCode = "";
                if (recUnitProject != null)
                {
                    ONShoreCommCode = recUnitProject.GetValueByKeyWord("RPO_ONSHORE");
                }

                string OFFShoreCommCode = "";
                if (recUnitProject != null)
                {
                    OFFShoreCommCode = recUnitProject.GetValueByKeyWord("RPO_OFFSHORE");
                }

                //string runNum = getDocNumber(dbsource, RootProjectCode, recType, CommUnitCode, recUnitCode);
                //if (string.IsNullOrEmpty(runNum)) runNum = "001";

                string recNumber = Document.getDocTempNumber(dbsource, RootProjectCode, "R", recType, CommUnitCode, recUnitCode);

                // string recNumber = RootProjectCode + "-" + CommUnitCode + "-" + recUnitCode + "-" + recType + "-" + runNum;
                #endregion

                string recCode = m_Doc.Code;

                //string DocNumber = getDocNumber(m_Doc.Project, RootProjectCode, strCompany);
                string strDesc = m_Doc.O_itemname;

                JObject joRecCompany  = new JObject();
                JObject joSendCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue3) && data6.O_sValue3 == curUser.ToString)
                    {
                        joSendCompany.Add(new JProperty(data6.O_Code, data6.O_Desc));
                    }
                }

                if (!string.IsNullOrEmpty(ONShoreCommCode))
                {
                    joRecCompany.Add(new JProperty(ONShoreCommCode, ONShoreCommCode));
                }

                if (!string.IsNullOrEmpty(OFFShoreCommCode))
                {
                    joRecCompany.Add(new JProperty(OFFShoreCommCode, OFFShoreCommCode));
                }

                JObject joData = new JObject(
                    new JProperty("RootProjectCode", RootProjectCode),
                    new JProperty("RootProjectDesc", RootProjectDesc),
                    //new JProperty("DocNumber", DocNumber),
                    new JProperty("DraftmanCode", curUser.Code),
                    new JProperty("DraftmanDesc", curUser.Description),
                    new JProperty("CommUnit", CommUnit),
                    new JProperty("RecCode", recCode),
                    new JProperty("RecNumber", recNumber),
                    new JProperty("RecCompanyList", joRecCompany),
                    new JProperty("SendCompanyList", joSendCompany),
                    new JProperty("DocType", recType)


                    );

                reJo.data    = new JArray(joData);
                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }
            return(reJo.Value);
        }
Пример #10
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EditDepartment(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strDepartmentId = "", strDepartmentCode = "", strDepartmentDesc = "",
                       strSecretarilman = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "departmentId":
                        strDepartmentId = strValue;
                        break;

                    case "departmentCode":
                        strDepartmentCode = strValue;
                        break;

                    case "departmentDesc":
                        strDepartmentDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strDepartmentCode))
                {
                    reJo.msg = "请输入部门编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strDepartmentDesc))
                {
                    reJo.msg = "请输入部门名称!";
                    return(reJo.Value);
                }
                #endregion

                //Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                //if (prjProject == null)
                //{
                //    reJo.msg = "获取项目目录失败!";
                //    return reJo.Value;
                //}



                //获取项目代码
                //string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                int departmentId = Convert.ToInt32(strDepartmentId);

                JArray  jaData       = new JArray();
                JObject joDepartment = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Communication");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    //if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode
                    if (data6.O_sValue1 == strDepartmentCode && data6.O_ID != departmentId)
                    {
                        reJo.msg = "已经存在相同的项目部门,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == departmentId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "项目部门ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                dictData.O_sValue1 = strDepartmentCode;
                dictData.O_Desc    = strDepartmentDesc;
                //dictData.O_sValue1 = strProjCode;
                dictData.O_sValue4 = strSecretarilman;// secretarilman.ToString;//
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                #endregion


                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #11
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject CreateCompany(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyCode = "", strCompanyDesc = "",
                       strSecretarilman = "", strCompanyChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strCompanyDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }

                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;

                JArray  jaData    = new JArray();
                JObject joCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode && data6.O_Code == strCompanyCode)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }

                //自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                SetUnitSecUser(sid, dbsource, prjProject, strCompanyCode, strCompanyDesc, ref strSecretarilman);

                //#region 自动设置文控,如果没有与单位代码一样的用户,就自动添加用户

                //if (string.IsNullOrEmpty(strSecretarilman))
                //{
                //    User secUser = dbsource.GetUserByCode(strCompanyCode);
                //    if (secUser == null)
                //    {
                //        ////UserController. CreateUser(sid, strCompanyCode, strCompanyDesc + "文控", "", "0",
                //        ////            "0", "", strCompanyCode, strCompanyCode);
                //        ////secUser = dbsource.GetUserByCode(strCompanyCode);
                //        secUser = dbsource.NewUser(
                //                            enUserFlage.OnLine,
                //                            enUserType.Default,
                //                                "",
                //                               strCompanyCode,
                //                                strCompanyDesc + "文控",
                //                                strCompanyCode,
                //                                "",
                //                                null
                //                                );

                //        if (secUser != null)
                //        {

                //            User m_user = secUser;
                //            m_user.O_suser1 = m_user.dBSource.GUID;

                //            m_user.Modify();

                //            // 强制刷新共享数据源
                //            //
                //            //DBSourceController.RefreshShareDBManager();
                //            DBSourceController.RefreshDBSource(sid);
                //            strSecretarilman = secUser.ToString;
                //        }
                //    }
                //    else
                //    {
                //        strSecretarilman = secUser.ToString;
                //    }
                //}
                //#endregion

                //dbsource.NewDictData
                #region 添加到数据字典
                //添加到数据字典

                //DictData dictdata = new DictData();
                //dictdata.StatusNew = true;
                //dictdata.O_skey = "Unit";
                //dictdata.O_datatype = (int)enDictDataType.TableHead;
                //dictdata.O_Code = strCompanyCode;
                //dictdata.O_Desc = strCompanyDesc;
                //dictdata.O_sValue1 = strProjCode;

                ////设置属性的值
                //SetDictDataPropertyValue(dictdata, 0);

                //dictdata.Modify();
                //strProjCode = "GEDI";

                string format = "insert CDMS_DictData (" +
                                "o_parentno,o_datatype,o_ikey,o_skey,o_Code,o_Desc,o_sValue1,o_sValue2,o_sValue3,o_sValue4,o_sValue5,o_iValue1 ,o_iValue2)" +
                                " values ({0},{1},{2},'{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}',{11},{12}" + ")";
                //0,2,0,'Unit','"+strCompanyCode+"','"+strCompanyDesc+"','"+strProjCode+ "','','','','',0,0
                format = string.Format(format, new object[] {
                    0, 2, 0, "Unit", strCompanyCode, strCompanyDesc, strProjCode, "", strSecretarilman, "", "", 0, 0
                });
                dbsource.DBExecuteSQL(format);

                DBSourceController.refreshDBSource(sid);

                //自动创建通信类下的单位目录
                CreateUnitProject(dbsource, prjProject, strCompanyCode, strCompanyDesc, strSecretarilman);

                ////通过以上的dictdata新建一个DictData
                //DictData newDictData = CreateNewDictData(dbsource, dictdata, enDictDataType.TableHead);

                //if (!newDictData.Write())
                //{
                //    //MessageBox.Show("创建失败!", "提示", MessageBoxButtons.OK);
                //    reJo.msg = "创建失败!";
                //    return reJo.Value;
                //}
                #endregion

                ////获取所有厂家信息
                //TempDefn mTempDefn = GetTempDefn(dbsource, "COM_UNIT");
                //if (mTempDefn == null)
                //{
                //    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                //if (project == null)
                //{
                //    reJo.msg = "新建版本目录失败,请联系管理员!";
                //    return reJo.Value;
                //}

                ////增加附加属性
                //try
                //{
                //    //project.GetAttrDataByKeyWord("FC_COMPANYCODE").SetCodeDesc(strCompanyCode);       //厂家编码
                //    //project.GetAttrDataByKeyWord("FC_COMPANYCHINESE").SetCodeDesc(strCompanyChinese);    //厂家名称
                //    //project.GetAttrDataByKeyWord("FC_ADDRESS").SetCodeDesc(strAddress);           //厂家地址
                //    //project.GetAttrDataByKeyWord("FC_PROVINCE").SetCodeDesc(strProvince);          //厂家省份
                //    //project.GetAttrDataByKeyWord("FC_POSTCODE").SetCodeDesc(strPostCode);          //厂家邮政
                //    //project.GetAttrDataByKeyWord("FC_EMAIL").SetCodeDesc(strEMail);             //厂家邮箱
                //    //project.GetAttrDataByKeyWord("FC_RECEIVER").SetCodeDesc(strReceiver);          //厂家收件人
                //    //project.GetAttrDataByKeyWord("FC_FAXNO").SetCodeDesc(strFaxNo);             //厂家传真号
                //    //project.GetAttrDataByKeyWord("FC_PHONE").SetCodeDesc(strPhone);             //收件人电话
                //    //project.AttrDataList.SaveData();
                //}
                //catch (Exception ex)
                //{
                //    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                //    reJo.msg = "获取厂家模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }
Пример #12
0
        /// <summary>
        /// 新建厂家资料目录
        /// </summary>
        public static JObject EditCompany(string sid, string ProjectKeyword, string projectAttrJson)
        {
            ExReJObject reJo = new ExReJObject();

            try
            {
                User curUser = DBSourceController.GetCurrentUser(sid);
                if (curUser == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                DBSource dbsource = curUser.dBSource;
                if (dbsource == null)
                {
                    reJo.msg = "登录验证失败!请尝试重新登录!";
                    return(reJo.Value);
                }

                Project m_prj = dbsource.GetProjectByKeyWord(ProjectKeyword);
                if (m_prj == null)
                {
                    reJo.msg = "参数错误,目录不存在!";
                    return(reJo.Value);
                }


                #region 获取传递过来的属性参数
                //获取传递过来的属性参数
                JArray jaAttr = (JArray)JsonConvert.DeserializeObject(projectAttrJson);

                string strCompanyId = "", strCompanyCode = "", strCompanyDesc = "",
                       strSecretarilman = "", strCompanyChinese = "",
                       strAddress = "", strProvince = "",
                       strPostCode = "", strEMail = "",
                       strReceiver = "", strFaxNo = "", strPhone = "";

                foreach (JObject joAttr in jaAttr)
                {
                    string strName  = joAttr["name"].ToString();
                    string strValue = joAttr["value"].ToString();

                    switch (strName)
                    {
                    case "companyId":
                        strCompanyId = strValue;
                        break;

                    case "companyCode":
                        strCompanyCode = strValue;
                        break;

                    case "companyDesc":
                        strCompanyDesc = strValue;
                        break;

                    case "secretarilman":
                        strSecretarilman = strValue;
                        break;
                    }
                }

                if (string.IsNullOrEmpty(strCompanyCode))
                {
                    reJo.msg = "请输入项目编号!";
                    return(reJo.Value);
                }
                if (string.IsNullOrEmpty(strCompanyDesc))
                {
                    reJo.msg = "请输入项目名称!";
                    return(reJo.Value);
                }
                #endregion

                Project prjProject = CommonFunction.getParentProjectByTempDefn(m_prj, "HXNY_DOCUMENTSYSTEM");

                if (prjProject == null)
                {
                    reJo.msg = "获取项目目录失败!";
                    return(reJo.Value);
                }

                //User secretarilman = dbsource.GetUserByKeyWord(strSecretarilman);
                //if (secretarilman == null)
                //{
                //    reJo.msg = "参数错误!文控角色所选择的用户不存在!";
                //    return reJo.Value;
                //}

                int companyId = Convert.ToInt32(strCompanyId);
                //获取项目代码
                string strProjCode = prjProject.Code;//.GetAttrDataByKeyWord("COMPANY").ToString;


                JArray  jaData    = new JArray();
                JObject joCompany = new JObject();

                List <DictData> dictDataList = dbsource.GetDictDataList("Unit");
                //[o_Code]:公司编码,[o_Desc]:公司描述,[o_sValue1]:项目代码

                foreach (DictData data6 in dictDataList)
                {
                    if (!string.IsNullOrEmpty(data6.O_sValue1) && data6.O_sValue1 == strProjCode &&
                        data6.O_Code == strCompanyCode && data6.O_ID != companyId)
                    {
                        reJo.msg = "已经存在相同的参建单位,请返回重试!";
                        return(reJo.Value);
                    }
                }
                //dbsource.NewDictData


                #region 添加到数据字典
                //添加到数据字典

                //DictData dictdata = new DictData();
                //dictdata.StatusNew = true;
                //dictdata.O_skey = "Unit";
                //dictdata.O_datatype = (int)enDictDataType.TableHead;
                //dictdata.O_Code = strCompanyCode;
                //dictdata.O_Desc = strCompanyDesc;
                //dictdata.O_sValue1 = strProjCode;

                ////设置属性的值
                //SetDictDataPropertyValue(dictdata, 0);

                //dictdata.Modify();
                DictData dictData = null;

                foreach (DictData data6 in dictDataList)
                {
                    if (data6.O_ID == companyId)
                    {
                        dictData = data6;
                    }
                }

                if (dictData == null)
                {
                    reJo.msg = "参建单位ID不存在,请返回重试!";
                    return(reJo.Value);
                }

                //自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                SetUnitSecUser(sid, dbsource, prjProject, strCompanyCode, strCompanyDesc, ref strSecretarilman);
                //#region 自动设置文控,如果没有与单位代码一样的用户,就自动添加用户
                //User secUser = null;
                //if (string.IsNullOrEmpty(strSecretarilman))
                //{
                //    secUser = dbsource.GetUserByCode(strCompanyCode);
                //    if (secUser == null)
                //    {
                //        ////UserController. CreateUser(sid, strCompanyCode, strCompanyDesc + "文控", "", "0",
                //        ////            "0", "", strCompanyCode, strCompanyCode);
                //        ////secUser = dbsource.GetUserByCode(strCompanyCode);
                //        secUser = dbsource.NewUser(
                //                            enUserFlage.OnLine,
                //                            enUserType.Default,
                //                                "",
                //                               strCompanyCode,
                //                                strCompanyDesc + "文控",
                //                                strCompanyCode,
                //                                "",
                //                                null
                //                                );

                //        if (secUser != null)
                //        {

                //            User m_user = secUser;
                //            m_user.O_suser1 = m_user.dBSource.GUID;

                //            m_user.Modify();



                //            // 强制刷新共享数据源
                //            //
                //            //DBSourceController.RefreshShareDBManager();
                //            DBSourceController.RefreshDBSource(sid);
                //            strSecretarilman = secUser.ToString;
                //        }
                //    }
                //    else
                //    {
                //        strSecretarilman = secUser.ToString;
                //    }


                //}

                //if (secUser != null)
                //{
                //    //把用户添加到项目管理类里面的项目单位用户组
                //    Group group = dbsource.GetGroupByName(prjProject.Code + "_ALLUnit");


                //    if (group != null)
                //    {
                //        group.AddUser(secUser);
                //        group.Modify();
                //    }
                //}
                //    #endregion

                dictData.O_Code    = strCompanyCode;
                dictData.O_Desc    = strCompanyDesc;
                dictData.O_sValue1 = strProjCode;
                dictData.O_sValue3 = strSecretarilman;// secretarilman.ToString;//
                dictData.Modify();

                DBSourceController.refreshDBSource(sid);

                ////通过以上的dictdata新建一个DictData
                //DictData newDictData = CreateNewDictData(dbsource, dictdata, enDictDataType.TableHead);

                //if (!newDictData.Write())
                //{
                //    //MessageBox.Show("创建失败!", "提示", MessageBoxButtons.OK);
                //    reJo.msg = "创建失败!";
                //    return reJo.Value;
                //}
                #endregion

                //自动创建通信类下的单位目录
                CreateUnitProject(dbsource, prjProject, strCompanyCode, strCompanyDesc, strSecretarilman);

                ////自动创建通信类下的单位目录
                //#region 自动创建通信类下的单位目录
                //try
                //{
                //    TempDefn mTempDefn = Company.GetTempDefn(dbsource, "COM_UNIT");
                //    if (mTempDefn != null)
                //    {
                //        Project cdProject = CommonFunction.GetProjectByDesc(prjProject, "存档管理");
                //        if (cdProject != null)
                //        {
                //            Project txProject = CommonFunction.GetProjectByDesc(cdProject, "通信类");
                //            if (txProject != null)
                //            {
                //                Project project = txProject.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);

                //                if (project != null)
                //                {
                //                    //增加附加属性
                //                    try
                //                    {
                //                        project.GetAttrDataByKeyWord("UN_SECRETAARECTOR").SetCodeDesc(strSecretarilman);             //文控
                //                        project.AttrDataList.SaveData();
                //                    }
                //                    catch (Exception ex)
                //                    {
                //                        //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                //                        reJo.msg = "获取厂家模板失败,请联系管理员!";
                //                        return reJo.Value;
                //                    }

                //                    TempDefn sfwTempDefn = Company.GetTempDefn(dbsource, "STO_SUBDOCUMENT");
                //                    if (sfwTempDefn != null)
                //                    {
                //                        Project swProject = project.NewProject("收文", "", m_prj.Storage, sfwTempDefn);
                //                        Project fwProject = project.NewProject("发文", "", m_prj.Storage, sfwTempDefn);

                //                        TempDefn typeTempDefn = Company.GetTempDefn(dbsource, "STO_COMTYPE");
                //                        if (typeTempDefn != null)
                //                        {
                //                            if (swProject != null)
                //                            {
                //                                swProject.NewProject("红头文", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("会议纪要", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("文件传递单", "", m_prj.Storage, typeTempDefn);
                //                                swProject.NewProject("信函", "", m_prj.Storage, typeTempDefn);
                //                            }

                //                            if (fwProject != null)
                //                            {
                //                                fwProject.NewProject("红头文", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("会议纪要", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("文件传递单", "", m_prj.Storage, typeTempDefn);
                //                                fwProject.NewProject("信函", "", m_prj.Storage, typeTempDefn);
                //                            }
                //                        }
                //                    }
                //                }
                //            }
                //        }
                //    }
                //}
                //catch
                //{

                //}
                //#endregion

                //prjProject.GetProjectByName();


                //    reJo.msg = "获取参建单位模板失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //Project project = m_prj.NewProject(strCompanyCode, strCompanyDesc, m_prj.Storage, mTempDefn);
                //if (project == null)
                //{
                //    reJo.msg = "新建版本目录失败,请联系管理员!";
                //    return reJo.Value;
                //}

                //增加附加属性
                try
                {
                    //project.GetAttrDataByKeyWord("FC_COMPANYCODE").SetCodeDesc(strCompanyCode);       //厂家编码
                    //project.GetAttrDataByKeyWord("FC_COMPANYCHINESE").SetCodeDesc(strCompanyChinese);    //厂家名称
                    //project.GetAttrDataByKeyWord("FC_ADDRESS").SetCodeDesc(strAddress);           //厂家地址
                    //project.GetAttrDataByKeyWord("FC_PROVINCE").SetCodeDesc(strProvince);          //厂家省份
                    //project.GetAttrDataByKeyWord("FC_POSTCODE").SetCodeDesc(strPostCode);          //厂家邮政
                    //project.GetAttrDataByKeyWord("FC_EMAIL").SetCodeDesc(strEMail);             //厂家邮箱
                    //project.GetAttrDataByKeyWord("FC_RECEIVER").SetCodeDesc(strReceiver);          //厂家收件人
                    //project.GetAttrDataByKeyWord("FC_FAXNO").SetCodeDesc(strFaxNo);             //厂家传真号
                    //project.GetAttrDataByKeyWord("FC_PHONE").SetCodeDesc(strPhone);             //收件人电话
                    //project.AttrDataList.SaveData();
                }
                catch (Exception ex)
                {
                    //MessageBox.Show("获取厂家模板失败,请联系管理员!");
                    reJo.msg = "获取厂家模板失败,请联系管理员!";
                    return(reJo.Value);
                }

                //reJo.data = new JArray(new JObject(new JProperty("ProjectKeyword", project.KeyWord)));

                reJo.success = true;
                return(reJo.Value);
            }
            catch (Exception e)
            {
                reJo.msg = e.Message;
                CommonController.WebWriteLog(reJo.msg);
            }

            return(reJo.Value);
        }