protected void Page_Load(object sender, EventArgs e)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            //如果当前用户未登陆,先获取授权
            if (user == null)
            {
                WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
                if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
                {//授权成功
                    WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                    if (wuser == null || string.IsNullOrEmpty(wuser.GwyUserName))
                    {//账号未关联,跳转至登录界面
                        System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=MyDeclareList");
                    }
                    else if (wuser.IsCustomer != 1 && wuser.IsCompany != 1)
                    {//不是企业或委托单位,无此权限
                        System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
                    }
                    else
                    {//不需登录,保存当前用户
                        HttpContext.Current.Session["user"] = wuser;
                    }
                }
                else
                {//获取授权失败,也跳转至登录页面
                    System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=MyDeclareList");
                }
            }
            else if (user.IsCustomer != 1 && user.IsCompany != 1)
            {//不是企业或委托单位,无此权限
                System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
            }
        }
Beispiel #2
0
        public static string BindList(string siteapplytime_s, string siteapplytime_e, string declcode, string customareacode, string ispass, string ischeck, string busitype
                                      , string modifyflag, string auditflag, string busiunit, string ordercode, string cusno, string divideno, string contractno
                                      , string submittime_s, string submittime_e, string sitepasstime_s, string sitepasstime_e
                                      , int start, int itemsPerLoad)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            DataSet ds = SiteDeclare.getSiteDeclareInfo(siteapplytime_s, siteapplytime_e, declcode, customareacode, ispass, ischeck, busitype
                                                        , getcode("modifyflag", modifyflag), auditflag, busiunit, ordercode, cusno, divideno, contractno
                                                        , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
                                                        , start, itemsPerLoad, user.CustomerCode);

            //DataSet ds = SiteDeclare.getSiteDeclareInfo(siteapplytime_s, siteapplytime_e, declcode, customareacode, ispass, ischeck, busitype
            //    , getcode("modifyflag", modifyflag), auditflag, busiunit, ordercode, cusno, divideno, contractno
            //    , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
            //    , start, itemsPerLoad, "KSJSBGYXGS");
            IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式

            iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            var json = "[{\"data\":" + JsonConvert.SerializeObject(ds.Tables[0], iso) + ",\"sum\":" + ds.Tables[1].Rows[0][0] + "}]";

            return(json);
        }
Beispiel #3
0
        public static string BindList(string reptime_s, string reptime_e, string declcode, string customsstatus, string modifyflag, string busitype, string ischeck
                                      , string ispass, string busiunit, string ordercode, string cusno, string tradeway, string contractno, string blno
                                      , string submittime_s, string submittime_e, string sitepasstime_s, string sitepasstime_e
                                      , int start, int itemsPerLoad)
        {
            LogHelper.Write("后台查询开始时间");

            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            DataSet ds = Declare.getDeclareInfo(reptime_s, reptime_e, declcode, customsstatus, getcode("modifyflag", modifyflag), busitype, ischeck
                                                , ispass, busiunit, ordercode, cusno, tradeway, contractno, blno
                                                , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
                                                , start, itemsPerLoad, user.CustomerCode);

            //DataSet ds = Declare.getDeclareInfo(reptime_s, reptime_e, declcode, customsstatus, getcode("modifyflag", modifyflag), busitype, ischeck
            //    , ispass, busiunit, ordercode, cusno, tradeway, contractno, blno
            //    , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
            //    , start, itemsPerLoad, "KSJSBGYXGS");

            IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式

            iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            var json = "[{\"data\":" + JsonConvert.SerializeObject(ds.Tables[0], iso) + ",\"sum\":" + ds.Tables[1].Rows[0][0] + "}]";

            LogHelper.Write("后台查询结束时间");
            LogHelper.Write("返回json:");
            LogHelper.Write(json);

            return(json);
        }
Beispiel #4
0
        public static string UserSignOut(string name, string pwd, string customer)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("{'flag':'false','url':'解绑失败!您当前尚未登录'}");
            }
            if (UserModel.DeleteUser(user.WCOpenID))
            {
                HttpContext.Current.Session["user"]        = null;
                HttpContext.Current.Session["openid"]      = null;
                HttpContext.Current.Session["nickname"]    = null;
                HttpContext.Current.Session["transferurl"] = null;
                return("{'flag':'true','url':'解绑成功'}");
            }
            else
            {
                HttpContext.Current.Session["user"]        = null;
                HttpContext.Current.Session["openid"]      = null;
                HttpContext.Current.Session["nickname"]    = null;
                HttpContext.Current.Session["transferurl"] = null;
                return("{'flag':'false','url':'解绑失败!当前账号未绑定'}");
            }
        }
Beispiel #5
0
 /// <summary>
 /// 根据opneid查询关联账号
 /// </summary>
 /// <param name="openid"></param>
 /// <returns></returns>
 public static WGUserEn getWeChatUser(string openid)
 {
     using (DBSession db = new DBSession())
     {
         string   sql   = "select * from wechat_user where wcopenid='" + openid + "' and rownum=1 and isunbind=0";
         WGUserEn wuser = db.QuerySignleEntity <WGUserEn>(sql);
         return(wuser);
     }
 }
Beispiel #6
0
        public static string getcuruser()
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            return("[{\"USERID\":" + user.GwyUserID + ",\"USERCODE\":'" + user.GwyUserCode + "',\"USERNAME\":'" + user.GwyUserName + "',\"CUSTOMERCODE\":'" + user.CustomerCode + "'}]");
        }
Beispiel #7
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="name"></param>
 /// <param name="pwd"></param>
 /// <param name="customer"></param>
 /// <returns></returns>
 public static WGUserEn LoginById(string id)
 {
     using (DBSession db = new DBSession())
     {
         string sql = @"select su.id as GWYUSERID,su.name as GWYUSERCODE,su.realname as GWYUSERNAME,csc.code as CUSTOMERCODE,csc.hscode,csc.iscompany,csc.iscustomer,csc.isreceiver 
                     from sys_user su left join cusdoc.sys_customer csc on su.customerid=csc.id where su.id={0} and su.enabled=1";
         sql = string.Format(sql, id);
         WGUserEn user = db.QuerySignleEntity <WGUserEn>(sql);
         return(user);
     }
 }
        public static string QuerySubscribeInfo(string subscribestart, string subscribeend, string declarationcode, string istrigger, string busitype, string busiunit, string ordercode,
                                                string cusno, string contract, string submitstart, string submitend, int pagesize, int lastnum)
        {
            string   sum  = "0";
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || user.GwyUserID <= 0)
            {
                return("");
            }
            DataTable infodt = SubscribeModel.getNewSubscribeInfo_Decl(subscribestart, subscribeend, declarationcode, istrigger, busitype, busiunit, ordercode, cusno, contract,
                                                                       submitstart, submitend, pagesize, lastnum, user.GwyUserID, out sum);

            //DataTable infodt = SubscribeModel.getNewSubscribeInfo_Decl(subscribestart, subscribeend, declarationcode, istrigger, busitype, busiunit, ordercode, cusno, contract,
            //    submitstart, submitend, pagesize, lastnum, 1124, out sum);
            if (infodt == null || infodt.Rows.Count == 0)
            {
                return("");
            }
            try
            {
                foreach (DataRow dr in infodt.Rows)
                {
                    if (string.IsNullOrEmpty(dr["transname"].ToString2()))
                    {
                        dr["transname"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["tradename"].ToString2()))
                    {
                        dr["tradename"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["status"].ToString2()))
                    {
                        dr["status"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["customsstatus"].ToString2()))
                    {
                        dr["customsstatus"] = "";
                    }
                    dr["sum"] = sum;
                }
                IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式
                iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                string json = JsonConvert.SerializeObject(infodt, iso);
                return(json);
            }
            catch (Exception e)
            {
                LogHelper.Write("MyBusiness_QueryData:" + e.Message);
                return("");
            }
        }
Beispiel #9
0
        public static string getUserInfo()
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("{'flag':'false','url':'您当前尚未登录'}");
            }
            else
            {
                return("{'flag':'true','code':'" + user.GwyUserCode + "','pwd':'000000','customercode':'" + user.CustomerCode + "'}");
            }
        }
Beispiel #10
0
 /// <summary>
 /// 新增账号
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public static bool SaveUser(WGUserEn user)
 {
     using (DBSession db = new DBSession())
     {
         //string sql = "delete from wechat_user where WCOpenID='" + user.WCOpenID + "'";
         //db.ExecuteSignle(sql);
         string sql = @"insert into wechat_user(id,GWYUSERCODE,GWYUSERNAME,WCOpenID,WCNickName,iscompany,iscustomer,isreceiver,customercode,createdate,gwyuserid,hscode) 
             values(wechat_user_id.nextval,'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',sysdate,{8},'{9}')";
         sql = string.Format(sql, user.GwyUserCode, user.GwyUserName, user.WCOpenID, user.WCNickName, user.IsCompany, user.IsCustomer, user.IsReceiver,
                             user.CustomerCode, user.GwyUserID, user.HSCode);
         return(db.ExecuteSignle(sql) == 0 ? false : true);
     }
 }
        public static string NewQuerySubscribeInfo()
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || user.GwyUserID <= 0)
            {
                return("");
            }
            DataTable infodt = SubscribeModel.getNewSubscribeInfo_Decl(user.GwyUserID);

            //DataTable infodt = SubscribeModel.getNewSubscribeInfo_Decl(1124);

            if (infodt == null || infodt.Rows.Count == 0)
            {
                return("");
            }
            try
            {
                foreach (DataRow dr in infodt.Rows)
                {
                    if (string.IsNullOrEmpty(dr["transname"].ToString2()))
                    {
                        dr["transname"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["tradename"].ToString2()))
                    {
                        dr["tradename"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["status"].ToString2()))
                    {
                        dr["status"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["customsstatus"].ToString2()))
                    {
                        dr["customsstatus"] = "";
                    }
                }
                IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式
                iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                string json = JsonConvert.SerializeObject(infodt, iso);
                return(json);
            }
            catch (Exception e)
            {
                LogHelper.Write("MyBusiness_QueryData:" + e.Message);
                return("");
            }
        }
Beispiel #12
0
        public static string ModifySave(string preinspcode, int modifyflag)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            bool bf      = Inspection.saveModifyFlag(preinspcode, modifyflag, user);
            var  jsonstr = "false";

            if (bf)
            {
                jsonstr = "success";
            }
            return(jsonstr);
        }
Beispiel #13
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="name"></param>
 /// <param name="pwd"></param>
 /// <param name="customer"></param>
 /// <returns></returns>
 public static WGUserEn Login(string name, string pwd, string customer, string openid, string nickname)
 {
     using (DBSession db = new DBSession())
     {
         pwd = pwd.Trim2().ToSHA1();
         string sql = @"select su.id as GWYUSERID,su.name GWYUSERCODE,su.realname as GWYUSERNAME,csc.code as CUSTOMERCODE,csc.hscode,csc.iscompany,csc.iscustomer,csc.isreceiver 
                     from sys_user su left join cusdoc.sys_customer csc on su.customerid=csc.id where su.name='{0}' and su.password='******' and csc.code='{2}' and su.enabled=1";
         sql = string.Format(sql, name.Trim2(), pwd, customer.Trim2().ToUpper());
         WGUserEn user = db.QuerySignleEntity <WGUserEn>(sql);
         if (user != null)
         {
             user.WCOpenID   = openid;
             user.WCNickName = nickname;
         }
         return(user);
     }
 }
Beispiel #14
0
        public static bool saveModifyFlag(string preinspcode, int modifyflag, WGUserEn user)
        {
            bool bf = false;

            try
            {
                string userid = user.GwyUserID.ToString(); string username = user.GwyUserCode; string realname = user.GwyUserName;
                //string userid = "763"; string username = "******"; string realname = "昆山吉时报关有限公司";

                using (DBSession db = new DBSession())
                {
                    string sql = "";

                    if (modifyflag == 1)
                    {
                        sql = @",delorderuserid='{1}',delorderusername='******',delordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')
                            ,modorderuserid=null,modorderusername=null,modordertime=null
                            ,modfinishuserid=null,modfinishusername=null,modfinishtime=null";
                    }
                    if (modifyflag == 2)
                    {
                        sql = @",delorderuserid=null,delorderusername=null,delordertime=null
                            ,modorderuserid='{1}',modorderusername='******',modordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')
                            ,modfinishuserid=null,modfinishusername=null,modfinishtime=null";
                    }
                    if (modifyflag == 3)
                    {
                        sql = @",delorderuserid=null,delorderusername=null,delordertime=null
                            ,modorderuserid=null,modorderusername=null,modordertime=null
                            ,modfinishuserid='{1}',modfinishusername='******',modfinishtime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')";
                    }

                    sql = @"update list_inspection set modifyflag=" + modifyflag + sql + " where code='{0}'";
                    sql = string.Format(sql, preinspcode, userid, realname, DateTime.Now);
                    db.ExecuteSignle(sql);

                    bf = true;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Write("saveModifyFlag_sql:" + ex.Message + "——code:" + preinspcode + " modifyflag:" + modifyflag);
            }
            return(bf);
        }
Beispiel #15
0
//        public static string Pass(string ordercode)
//        {
//            string userid = "763"; string realname = "昆山吉时报关有限公司";

//            using (DBSession db = new DBSession())
//            {
//                string sql = "select to_char(sitepasstime,'yyyy/mm/dd hh24:mi:ss') as sitepasstime from list_order where code='" + ordercode + "'";
//                DataTable dt = db.QuerySignle(sql);
//                string curtime = dt.Rows[0]["SITEPASSTIME"].ToString();
//                if (curtime != "")
//                {
//                    return curtime.Left(curtime.Length - 3).Replace("/", "");
//                }

//                curtime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
//                sql = "update list_order set sitepassuserid='{1}',sitepassusername='******',sitepasstime=to_date('{3}','yyyy-MM-dd HH24:mi:ss'),declstatus=160 where code='{0}'";
//                sql = string.Format(sql, ordercode, userid, realname, curtime);
//                int i = db.ExecuteSignle(sql);
//                if (i > 0)
//                {
//                    MethodSvc.MethodServiceClient msc = new MethodSvc.MethodServiceClient();
//                    msc.redis_OrderStatusLog(ordercode);

//                    //add 20180115 保存操作记录list_times
////                    sql = @"insert into list_times(id,code,userid,realname,times,type,ispause)
////                        values(list_times_id.nextval,'" + ordercode + "','" + userid + "','" + realname + "',sysdate,'0',0)";
////                    db.ExecuteSignle(sql);

//                    //add 20180119 保存历史记录
//                    sql = @"insert into list_updatehistory(id,UPDATETIME,TYPE
//                                                            ,ORDERCODE,USERID,NEWFIELD,NAME,CODE,FIELD,FIELDNAME)
//                                                    values(LIST_UPDATEHISTORY_ID.nextval,sysdate,'1'
//                                                            ,'{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
//                    sql = string.Format(sql, ordercode, userid, curtime, realname, ordercode, "SITEPASSTIME", "报关放行");
//                    db.ExecuteSignle(sql);


//                    return curtime.Left(curtime.Length - 3).Replace("/", "");
//                }
//                else
//                {
//                    return "";
//                }

//                /*string curtime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
//                string sql = "update list_order set sitepassuserid='{1}',sitepassusername='******',sitepasstime=to_date('{3}','yyyy-MM-dd HH24:mi:ss') where code='{0}'";
//                sql = string.Format(sql, ordercode, "763", "昆山吉时报关有限公司", curtime);
//                int i = db.ExecuteSignle(sql);
//                if (i > 0)
//                {
//                    return curtime.Left(curtime.Length - 3).Replace("/", "");
//                }
//                else
//                {
//                    return "";
//                }*/
//            }
//        }

        public static string Passall(string ordercode, WGUserEn user)
        {
            string userid = user.GwyUserID.ToString(); string username = user.GwyUserCode; string realname = user.GwyUserName;

            //string userid = "763"; string username = "******"; string realname = "昆山吉时报关有限公司";

            using (DBSession db = new DBSession())
            {
                string    sql     = "select to_char(sitepasstime,'yyyy/mm/dd hh24:mi:ss') as sitepasstime from list_order where code='" + ordercode + "'";
                DataTable dt      = db.QuerySignle(sql);
                string    curtime = dt.Rows[0]["SITEPASSTIME"].ToString();
                if (curtime != "")
                {
                    return("{\"ORDERCODE\":'" + ordercode + "',\"CURTIME\":'" + curtime.Left(curtime.Length - 3).Replace("/", "") + "',\"FLAG\":'',\"ISEXISTS\":'Y'}");
                }

                curtime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                sql     = "update list_order set sitepassuserid='{1}',sitepassusername='******',sitepasstime=to_date('{3}','yyyy-MM-dd HH24:mi:ss'),declstatus=160 where code='{0}' and declstatus<=160";
                sql     = string.Format(sql, ordercode, userid, realname, curtime);
                int i = db.ExecuteSignle(sql);
                if (i > 0)
                {
                    MethodSvc.MethodServiceClient msc = new MethodSvc.MethodServiceClient();
                    msc.redis_OrderStatusLog(ordercode);

                    //add 20180119 保存历史记录
                    sql = @"insert into list_updatehistory(id,UPDATETIME,TYPE
                                                            ,ORDERCODE,USERID,NEWFIELD,NAME,CODE,FIELD,FIELDNAME) 
                                                    values(LIST_UPDATEHISTORY_ID.nextval,sysdate,'1'
                                                            ,'{0}','{1}','{2}','{3}','{4}','{5}','{6}')";
                    sql = string.Format(sql, ordercode, userid, curtime, realname, ordercode, "SITEPASSTIME", "报关放行");
                    db.ExecuteSignle(sql);

                    return("{\"ORDERCODE\":'" + ordercode + "',\"CURTIME\":'" + curtime.Left(curtime.Length - 3).Replace("/", "") + "',\"FLAG\":'S',\"ISEXISTS\":'N'}");
                }
                else
                {
                    return("{\"ORDERCODE\":'" + ordercode + "',\"CURTIME\":'" + curtime.Left(curtime.Length - 3).Replace("/", "") + "',\"FLAG\":'E',\"ISEXISTS\":'N'}");
                }
            }
        }
Beispiel #16
0
        public static string Passall(string ordercode)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }

            string msg = "";
            JArray ja  = JArray.Parse(ordercode);

            for (int i = 0; i < ja.Count; i++)
            {
                msg = msg + SiteDeclare.Passall(ja[i].ToString(), user);
                if (i != ja.Count - 1)
                {
                    msg = msg + ",";
                }
            }
            return("[" + msg + "]");
        }
Beispiel #17
0
        public static string BindList(string reptime_s, string reptime_e, string declcode, string customsstatus, string modifyflag, string busitype, string ischeck
                                      , string ispass, string busiunit, string ordercode, string cusno, string tradeway, string contractno, string blno
                                      , string submittime_s, string submittime_e, string sitepasstime_s, string sitepasstime_e
                                      , int start, int itemsPerLoad)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("[]");
            }
            string customerCode = user.CustomerCode;
            string hsCode       = user.HSCode;

            if (user.IsCompany != 1)//如果不是企业角色,不能查出其对应经营单位的订单
            {
                hsCode = "";
            }
            if (user.IsCustomer != 1)//如果不是委托单位角色,不能查出其对应委托单位的订单
            {
                customerCode = "";
            }
            DataSet ds = Declare.getDeclareInfo_my(reptime_s, reptime_e, declcode, customsstatus, getcode("modifyflag", modifyflag), busitype, ischeck
                                                   , ischeck, busiunit, ordercode, cusno, tradeway, contractno, blno
                                                   , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
                                                   , start, itemsPerLoad, customerCode, hsCode);

            //DataSet ds = Declare.getDeclareInfo_my(reptime_s, reptime_e, declcode, customsstatus, getcode("modifyflag", modifyflag), busitype, ischeck
            //    , ischeck, busiunit, ordercode, cusno, tradeway, contractno, blno
            //    , submittime_s, submittime_e, sitepasstime_s, sitepasstime_e
            //    , start, itemsPerLoad, "RBDZKJKSYXGS", "3223640003");

            IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式

            iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            var json = "[{\"data\":" + JsonConvert.SerializeObject(ds.Tables[0], iso) + ",\"sum\":" + ds.Tables[1].Rows[0][0] + "}]";

            return(json);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];

            //如果当前用户未登陆,先获取授权
            if (user == null)
            {
                WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
                if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
                {//授权成功
                    LogHelper.Write("第9步:" + userInfo.OpenID);
                    WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                    if (wuser == null || string.IsNullOrEmpty(wuser.GwyUserName))
                    {//账号未关联,跳转至登录界面
                        LogHelper.Write("第10步:" + userInfo.OpenID);
                        System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=SiteInspectionList");
                    }
                    else if (wuser.IsReceiver != 1)
                    {//不是接单单位,无此权限
                        LogHelper.Write("第11步:" + userInfo.OpenID);
                        System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
                    }
                    else
                    {//不需登录,保存当前用户
                        HttpContext.Current.Session["user"] = wuser;
                    }
                    LogHelper.Write("第12步:" + wuser.WCOpenID);
                }
                else
                {//获取授权失败,也跳转至登录页面
                    System.Web.HttpContext.Current.Response.Redirect(@"../Login.aspx?openid=" + userInfo.OpenID + "&nickname=" + userInfo.NickName + "&transferurl=SiteDeclareList");
                }
            }
            else if (user.IsReceiver != 1)
            {//不是接单单位,无此权限
                System.Web.HttpContext.Current.Response.Redirect(@"../WarnPage.aspx");
            }
        }
Beispiel #19
0
 /// <summary>
 /// 账号绑定
 /// </summary>
 /// <param name="userid"></param>
 /// <param name="openid"></param>
 /// <param name="nickname"></param>
 private static bool login(string userid, string openid, string nickname)
 {
     try
     {
         userid = userid.Replace("QRSCENE_", "").Replace("qrscene_", "");
         WGUserEn user = UserModel.LoginById(userid);
         if (user != null)//登录成功
         {
             user.WCOpenID   = openid;
             user.WCNickName = getUserInfo(openid);
             if (!UserModel.UserExsit(user.GwyUserCode, user.WCOpenID, user.WCNickName)) //账号未绑定
             {
                 UserModel.SaveUser(user);                                               //绑定账号
                 return(true);
             }
         }
         return(false);
     }
     catch (Exception ex)
     {
         LogHelper.Write("扫码异常:" + ex.Message);
         return(false);
     }
 }
Beispiel #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];
         //如果当前用户未登陆,先获取授权
         if (user == null)
         {
             WUserEn userInfo = PageShowQuan.GetShouQuanMessage();
             if (userInfo != null && !string.IsNullOrEmpty(userInfo.OpenID))
             {//授权成功
                 WGUserEn wuser = UserModel.getWeChatUser(userInfo.OpenID);
                 if (wuser != null || string.IsNullOrEmpty(wuser.GwyUserName))
                 {
                     HttpContext.Current.Session["user"] = wuser;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         LogHelper.Write("SignOut解除绑定异常:" + ex.Message);
     }
 }
Beispiel #21
0
 public static string SubscribeStatus(string type, string status, string cusno, string declarationcode, string ordercode)
 {
     try
     {
         //存放订阅的数据数组
         List <string> orderData = new List <string>();
         //订阅过的节点
         string orderedLine = "";
         string codetype    = "0";
         if (status.Length > 0)
         {
             status = status.Substring(0, status.Length - 1);
         }
         string[] st = status.Split(',');
         //判断是否订阅的信息是否已经触发
         if (type == "报关状态")
         {
             if (string.IsNullOrEmpty(declarationcode) || declarationcode == "null")
             {
                 return("订阅失败,报关单号不能为空");
             }
             DataTable dt = SubscribeModel.getDeclstatus(declarationcode);
             for (int i = 0; i < st.Length; i++)
             {
                 if (dt.Rows.Count > 0 && SwitchHelper.switchValue(type, st[i]).ToInt32() <= SwitchHelper.switchValue(type, dt.Rows[0][0].ToString2()).ToInt32())
                 {
                     return("订阅失败,报关状态已过:" + st[i] + "");
                 }
             }
             codetype = "3";
         }
         else if (type == "物流状态")
         {
             if (string.IsNullOrEmpty(ordercode) || ordercode == "null")
             {
                 return("订阅失败,订单编号不能为空");
             }
             DataTable dt = SubscribeModel.getLogisticsstatus(ordercode);
             for (int i = 0; i < st.Length; i++)
             {
                 if (dt.Rows.Count > 0 && SwitchHelper.switchValue(type, st[i]).ToInt32() <= SwitchHelper.switchValue(type, dt.Rows[0][0].ToString2()).ToInt32())
                 {
                     return("订阅失败,物流状态已过:" + st[i] + "");
                 }
             }
             codetype = "2";
         }
         else if (type == "业务状态")
         {
             if (string.IsNullOrEmpty(ordercode) || ordercode == "null")
             {
                 return("订阅失败,订单编号不能为空");
             }
             DataTable dt = SubscribeModel.getOrderstatus(ordercode);
             for (int i = 0; i < st.Length; i++)
             {
                 if (dt.Rows.Count > 0 && SwitchHelper.switchValue(type, st[i]).ToInt32() <= dt.Rows[0][0].ToString2().ToInt32())
                 {
                     return("订阅失败,业务状态已过:" + st[i] + "");
                 }
             }
             codetype = "1";
         }
         WGUserEn user = (WGUserEn)HttpContext.Current.Session["user"];
         //防止重复订阅
         for (int i = 0; i < st.Length; i++)
         {
             DataTable getTriggerStatus = SubscribeModel.GetTriggerstatus(cusno, st[i], type, declarationcode, user.GwyUserID, ordercode);
             if (getTriggerStatus.Rows.Count > 0)
             {
                 orderData.Add(st[i]);
                 //return st[i] + "已订阅请勿重复订阅";
             }
         }
         if (orderData.Count == 0)
         {
             try
             {
                 SubscribeModel.insertSubscribe(type, st, cusno, declarationcode, user.GwyUserID, user.GwyUserName, user.WCOpenID, codetype, ordercode);
                 return("订阅成功");
             }
             catch (Exception e)
             {
                 return(e.Message);
             }
         }
         else
         {
             for (int i = 0; i < orderData.Count; i++)
             {
                 orderedLine = orderedLine + orderData[i].ToString() + ",";
             }
             int length = orderedLine.Length;
             return(orderedLine.Substring(0, length - 1) + "已订阅请勿重复订阅");
         }
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
Beispiel #22
0
        public static string UserLogin(string name, string pwd, string customer, string wcopenid, string wcnickname, string transferurl)
        {
            wcnickname = HttpUtility.UrlDecode(wcnickname);
            LogHelper.Write(wcopenid + "----" + wcnickname + "----" + transferurl);
            if (UserModel.UserExsit(name, wcopenid, wcnickname))
            {
                return("{'flag':'false','url':'登录失败!该账号已经绑定其它微信,请先解绑'}");
            }

            WGUserEn user = UserModel.Login(name, pwd, customer, wcopenid, wcnickname);

            if (user != null && !string.IsNullOrEmpty(user.GwyUserCode))
            {
                //1、判断权限
                if (transferurl == "DeclareList" || transferurl == "SiteDeclareList" || transferurl == "SiteInspectionList")
                {
                    if (user.IsReceiver != 1)
                    {
                        return("{'flag':'false','url':'登录失败!该账号不属于接单单位'}");
                    }
                }
                if (transferurl == "MyBusiness" || transferurl == "MyDeclareList" || transferurl == "MyInspectionList")
                {
                    if (user.IsCompany != 1 && user.IsCustomer != 1)
                    {
                        return("{'flag':'false','url':'登录失败!该账号不属于生产企业或委托单位'}");
                    }
                }
                //2、保存当前账号
                UserModel.SaveUser(user);
                //3、页面跳转
                switch (transferurl)
                {
                case "DeclareList":
                    transferurl = "http://gwy.jishiks.com/Page/BusiOpera/DeclareList.aspx";
                    break;

                case "SiteDeclareList":
                    transferurl = "http://gwy.jishiks.com/Page/BusiOpera/SiteDeclareList.aspx";
                    break;

                case "SiteInspectionList":
                    transferurl = "http://gwy.jishiks.com/Page/MyBusiness/SiteInspectionList.aspx";
                    break;

                case "MyBusiness":
                    transferurl = "http://gwy.jishiks.com/Page/MyBusiness/MyBusiness.aspx";
                    break;

                case "MyDeclareList":
                    transferurl = "http://gwy.jishiks.com/Page/MyBusiness/MyDeclareList.aspx";
                    break;

                case "MyInspectionList":
                    transferurl = "http://gwy.jishiks.com/Page/MyBusiness/MyInspectionList.aspx";
                    break;

                case "SubscribeList":
                    transferurl = "http://gwy.jishiks.com/Page/SubscribeList.aspx";
                    break;
                }
                return("{'flag':'true','url':'" + transferurl + "'}");
            }
            else
            {
                return("{'flag':'false','url':'登录失败!请重新核对账号'}");
            }
        }
Beispiel #23
0
        public static bool saveModifyFlag(string predelcode, int modifyflag, WGUserEn user)
        {
            bool bf = false;

            try
            {
                string userid = user.GwyUserID.ToString(); string username = user.GwyUserCode; string realname = user.GwyUserName;
                //string userid = "763"; string username = "******"; string realname = "昆山吉时报关有限公司";

                using (DBSession db = new DBSession())
                {
                    string sql = "";

                    sql = @"select code,ordercode,declarationcode from list_declaration ld where ld.code='" + predelcode + "'";
                    DataTable dt_decl   = db.QuerySignle(sql);
                    string    ordercode = dt_decl.Rows[0]["ordercode"].ToString();

                    if (modifyflag == 1)//删单1
                    {
                        sql = @"select ld.code,ld.ordercode from list_declaration ld inner join config_filesplit cfs on ld.busiunitcode=cfs.busiunitcode and cfs.filetype='53' and ld.code='" + predelcode + "'";
                        DataTable dt = db.QuerySignle(sql);
                        if (dt != null)
                        {
                            if (dt.Rows.Count > 0)
                            {
                                if (!string.IsNullOrEmpty(ordercode))
                                {
                                    sql = @"update list_attachmentdetail t1 set t1.filetypeid='162' where t1.ordercode='" + ordercode + "' and t1.filetypeid='53'";
                                    db.ExecuteSignle(sql);
                                }
                            }
                        }
                    }

                    if (modifyflag == 2)//改单2
                    {
                        DateTime time = DateTime.Now;
                        sql = @"update list_declaration_after set dataconfirm='1',dataconfirmusertime=to_date('" + time + "','yyyy-MM-dd HH24:mi:ss') where code='" + predelcode + "' and xzlb like '报关单%'";
                        db.ExecuteSignle(sql);
                    }

                    //改单完成3

                    //修改删改单标志
                    sql = @"update list_declaration set modifyflag=" + modifyflag;
                    //if (modifyflag == 1) { sql += ",delorderuserid='{1}',delorderusername='******',delordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')"; }
                    //if (modifyflag == 2) { sql += ",modorderuserid='{1}',modorderusername='******',modordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')"; }
                    //if (modifyflag == 3) { sql += ",modfinishuserid='{1}',modfinishusername='******',modfinishtime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')"; }

                    if (modifyflag == 1)
                    {
                        sql += @",delorderuserid='{1}',delorderusername='******',delordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')
                            ,modorderuserid=null,modorderusername=null,modordertime=null
                            ,modfinishuserid=null,modfinishusername=null,modfinishtime=null";
                    }
                    if (modifyflag == 2)
                    {
                        sql += @",delorderuserid=null,delorderusername=null,delordertime=null
                            ,modorderuserid='{1}',modorderusername='******',modordertime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')
                            ,modfinishuserid=null,modfinishusername=null,modfinishtime=null";
                    }
                    if (modifyflag == 3)
                    {
                        sql += @",delorderuserid=null,delorderusername=null,delordertime=null
                            ,modorderuserid=null,modorderusername=null,modordertime=null
                            ,modfinishuserid='{1}',modfinishusername='******',modfinishtime=to_date('{3}','yyyy-MM-dd HH24:mi:ss')";
                    }

                    sql += " where code='{0}'";
                    sql  = string.Format(sql, predelcode, userid, realname, DateTime.Now);
                    db.ExecuteSignle(sql);


                    //修改订单的报关状态
                    sql = "select customsstatus from list_declaration where ordercode='" + ordercode + "'  and isinvalid=0 and modifyflag<>1";
                    bool      flag            = true;
                    DataTable dt_order_status = db.QuerySignle(sql);
                    if (dt_order_status != null)
                    {
                        if (dt_order_status.Rows.Count > 0)
                        {
                            foreach (DataRow dr in dt_order_status.Rows)
                            {
                                if (dr["customsstatus"].ToString2() == "" || (dr["customsstatus"].ToString2() != "已结关" && dr["customsstatus"].ToString2() != "已放行"))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                    }
                    if (flag)
                    {
                        sql = "update list_order set declstatus=160,sitepassusername='******',sitepasstime=sysdate,siteapplyuserid=-2 where code='" + ordercode + "' and declstatus<=160";
                        db.ExecuteSignle(sql);
                    }

                    //---------------------------------------------------------------------------------------------------------------
                    //保存操作记录list_times
                    //sql = @"insert into list_times(id,code,userid,realname,times,type,ispause)
                    //values(list_times_id.nextval,'" + predelcode + "','" + userid + "','" + realname + "',sysdate,'1'," + modifyflag + ")";
                    //db.ExecuteSignle(sql);



                    //调用缓存接口redis_DeclarationLog
                    MethodSvc.MethodServiceClient msc = new MethodSvc.MethodServiceClient();
                    msc.redis_DeclarationLog(ordercode, predelcode, dt_decl.Rows[0]["declarationcode"].ToString(), "", "0");


                    sql = @"select code,entrusttype,declstatus,inspstatus from list_order lo where lo.code='" + ordercode + "'";
                    DataTable dt_order = db.QuerySignle(sql);

                    if (dt_order.Rows[0]["entrusttype"].ToString() == "03")
                    {
                        if (Convert.ToInt32(dt_order.Rows[0]["declstatus"].ToString()) >= 160 && Convert.ToInt32(dt_order.Rows[0]["inspstatus"].ToString()) >= 120)
                        {
                            //add 20180115 费用异常接口
                            msc.FinanceExceptionOrder(ordercode, username, "list_declaration.modifyflag修改为" + modifyflag.ToString());
                        }
                    }
                    else
                    {
                        if (Convert.ToInt32(dt_order.Rows[0]["declstatus"].ToString()) >= 160)
                        {
                            //add 20180115 费用异常接口
                            msc.FinanceExceptionOrder(dt_decl.Rows[0]["ordercode"].ToString(), username, "list_declaration.modifyflag修改为" + modifyflag.ToString());
                        }
                    }

                    bf = true;
                }
            }
            catch (Exception ex)
            {
                LogHelper.Write("saveModifyFlag_sql:" + ex.Message + "——code:" + predelcode + " modifyflag:" + modifyflag);
            }
            return(bf);
        }
Beispiel #24
0
        public static string QueryData(string submittimestart, string submittimeend, string declarationcode, string customarea, string ispass, string ischeck, string busitype,
                                       string modifyflag, string auditflag, string busiunit, string ordercode, string cusno, string divideno, string contractno, string passtimestart, string passtimeend,
                                       int itemsperload, int lastindex)
        {
            string         sum        = "0";
            ListOrderModel orderModel = new ListOrderModel();
            WGUserEn       user       = (WGUserEn)HttpContext.Current.Session["user"];

            if (user == null || string.IsNullOrEmpty(user.CustomerCode))
            {
                return("");
            }
            string customerCode = user.CustomerCode;
            string hsCode       = user.HSCode;

            if (user.IsCompany != 1)//如果不是企业角色,不能查出其对应经营单位的订单
            {
                hsCode = "";
            }
            if (user.IsCustomer != 1)//如果不是委托单位角色,不能查出其对应委托单位的订单
            {
                customerCode = "";
            }
            DataTable dt = orderModel.getOrder(submittimestart, submittimeend, declarationcode, customarea, ispass, ischeck, busitype, modifyflag, auditflag, busiunit, ordercode,
                                               cusno, divideno, contractno, passtimestart, passtimeend, itemsperload, lastindex, customerCode, hsCode, out sum);

            //DataTable dt = orderModel.getOrder(submittimestart, submittimeend, declarationcode, customarea, ispass, ischeck, busitype, modifyflag, auditflag, busiunit, ordercode,
            //   cusno, divideno, contractno, passtimestart, passtimeend, itemsperload, lastindex, "RBDZKJKSYXGS", "3223640003", out sum);
            IsoDateTimeConverter iso = new IsoDateTimeConverter();//序列化JSON对象时,日期的处理格式

            try
            {
                foreach (DataRow dr in dt.Rows)
                {
                    dr["ischeck"]     = dr["ischeck"].ToString2() == "1" ? "海关查验" : "";
                    dr["checkpic"]    = dr["checkpic"].ToString2() == "1" ? "含查验图片" : "";
                    dr["inspischeck"] = dr["inspischeck"].ToString2() == "1" ? "国检查验" : "";
                    dr["lawflag"]     = dr["lawflag"].ToString2() == "1" ? "含法检" : "";
                    dr["declstatus"]  = SwitchHelper.switchValue("declstatus", dr["declstatus"].ToString2());
                    dr["inspstatus"]  = SwitchHelper.switchValue("inspstatus", dr["inspstatus"].ToString2());
                    if (string.IsNullOrEmpty(dr["divideno"].ToString2()))
                    {
                        dr["divideno"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["logisticsstatus"].ToString2()))
                    {
                        dr["logisticsstatus"] = "";
                    }
                    if (string.IsNullOrEmpty(dr["contractno"].ToString2()))
                    {
                        dr["contractno"] = "";
                    }
                    dr["sum"] = sum;
                }
            }
            catch (Exception e)
            {
                LogHelper.Write("MyBusiness_QueryData:" + e.Message);
            }

            iso.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
            string json = JsonConvert.SerializeObject(dt, iso);

            return(json);
        }