王 垚
2022-02-16 77e7afb2172eb44226674d5d803e9eb78b9bc3b6
WebAPI/Controllers/WebAPIController.cs
@@ -133,6 +133,38 @@
            }
        }
        /// <summary>
        /// 获取登录页组织列
        /// </summary>
        /// <returns></returns>
        [Route("GetOrganizations")]
        [HttpGet]
        public object GetOrganizations()
        {
            try
            {
                ClsCN oCn = new ClsCN();
                DataSet oDs = new DataSet();
                //==========
                oDs = oCn.RunProcReturn("select HItemID ID,Hname Name,HStopflag Stopflag from Xt_ORGANIZATIONS", "Xt_ORGANIZATIONS");
                objjson.code = "1";
                objjson.count = 1;
                objjson.Message = "获取成功!";
                objjson.data = oDs.Tables[0];
                return objjson; ;
            }
            catch (Exception e)
            {
                objjson.code = "0";
                objjson.count = 0;
                objjson.Message = "获取失败!异常" + e.ToString();
                objjson.data = null;
                return objjson; ;
            }
        }
        /// <summary>
        /// 登录
        /// </summary>
@@ -148,7 +180,15 @@
                DataSet ds = null;
                ClsCNSRM oCnLoc = new ClsCNSRM();
                DAL.ClsUser oUser = new DAL.ClsUser();
                ds = oUser.CheckCzymc(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
                //LogService.Write("测试1:"+ DBUtility.ClsPub.sExeReturnInfo);
                string FCusName = oSystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
                //LogService.Write("测试2:" + DBUtility.ClsPub.sExeReturnInfo);
                //LogService.Write(FCusName);
                if (FCusName == "夏宝电器")
                    ds = oUser.CheckMainID(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                else
                    ds = oUser.CheckCzymc(UserName.Trim(), DBUtility.ClsPub.StrToPsd(PassWord.Trim()));
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
@@ -201,12 +241,13 @@
                    return objJsonResult; ;
                }
                //===========
                oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czymc='" + UserName + "'", "Gy_Czygl");
                //LogService.Write("select Czmm from  Gy_Czygl where Czymc='" + UserName + "' and  Czmm = '" + DBUtility.ClsPub.StrToPsd(oldPassword.Trim()) + "'");
                oDs = oCn.RunProcReturn("select Czmm from  Gy_Czygl where Czymc='" + UserName + "' and  Czmm = '" + DBUtility.ClsPub.StrToPsd(oldPassword.Trim()) + "'", "Gy_Czygl");
                if (oDs == null || oDs.Tables[0].Rows.Count == 0)
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "没有这个用户,不能修改密码!";
                    objJsonResult.Message = "原密码错误!";
                    objJsonResult.data = null;
                    return objJsonResult; ;
                }
@@ -336,13 +377,13 @@
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Insert into SRM_OpenTmp " +
                    " (HNumber,HModel,HName) " +
                    " Values('" + HNumber + "','" + HName + "','" + HName + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                //修改上级为非末级代码
                //oCn.RunProc("Update Gy_OpenTmp set HEndflag=0 where HItemID=" + oModel.HParentID, ref ClsPub.sExeReturnInfo);
                oCn.Commit();
                //oCn.BeginTran();
                //oCn.RunProc("Insert into SRM_OpenTmp " +
                //    " (HNumber,HModel,HName) " +
                //    " Values('" + HNumber + "','" + HName + "','" + HName + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                ////修改上级为非末级代码
                ////oCn.RunProc("Update Gy_OpenTmp set HEndflag=0 where HItemID=" + oModel.HParentID, ref ClsPub.sExeReturnInfo);
                //oCn.Commit();
                objjson.code = "0";
                objjson.count = 1;
                objjson.Message = "保存成功!";
@@ -372,9 +413,9 @@
            ClsCNSRM oCn = new ClsCNSRM();
            try
            {
                oCn.BeginTran();
                oCn.RunProc("Delete from SRM_OpenTmp where HItemID='" + DBUtility.ClsPub.isLong(HItemID) + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                //oCn.BeginTran();
                //oCn.RunProc("Delete from SRM_OpenTmp where HItemID='" + DBUtility.ClsPub.isLong(HItemID) + "'", ref DBUtility.ClsPub.sExeReturnInfo);
                //oCn.Commit();
                objjson.code = "0";
                objjson.count = 1;
                objjson.Message = "删除成功!";
@@ -744,7 +785,8 @@
                objJsonResult.Message = "返回数据成功!";
                objJsonResult.data = oDs;
            }
            else {
            else
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "返回数据失败!";
@@ -757,17 +799,17 @@
        #region[更改公告状态]
        [Route("UpdateMessage")]
        [HttpGet]
        public object UpdateMessage(string UserName, string HInterID,string HEntryID)
        public object UpdateMessage(string UserName, string HInterID, string HEntryID)
        {
            ClsCNSRM oCn = new ClsCNSRM();
            oCn.BeginTran();
            oCn.RunProc("Update OA_InformBillSub set HReadFlag=1 HUpDater='"+ UserName + "',HUpDateDate=getdate() where HInterID='" + HInterID + "' and HEntryID='"+ HEntryID + "'", ref ClsPub.sExeReturnInfo);
            oCn.RunProc("Update OA_InformBillSub set HReadFlag=1 HUpDater='" + UserName + "',HUpDateDate=getdate() where HInterID='" + HInterID + "' and HEntryID='" + HEntryID + "'", ref ClsPub.sExeReturnInfo);
            oCn.Commit();
            objjson.code = "1";
            objjson.count = 1;
            objjson.Message =ClsPub.sExeReturnInfo;
            objjson.Message = ClsPub.sExeReturnInfo;
            objjson.data = null;
            return objjson;;
            return objjson; ;
        }
        #endregion
    }