コード例 #1
0
        public Result Txn110104(ClientInfo ci, RequestInfo ri, DbConnections db, ref Log lg)
        {
            Result res = new Result();

            object[] value      = (object[])ri.ReceivedParam[0];
            object[] obj        = new object[19];
            int      userno     = Static.ToInt(ri.ReceivedParam[5]);
            long     olpassword = Static.ToLong(ri.ReceivedParam[3]);
            long     password   = Static.ToLong(ri.ReceivedParam[4]);


            Result PassPolicy = new Result();

            PassPolicy = DBIO.DB216001(db);
            DataRow _dr;

            _dr = PassPolicy.Data.Tables[0].Rows[0];

            Result pres = new Result();

            pres = DBIO.DB203002(db, userno);
            DataRow _drow;

            _drow = pres.Data.Tables[0].Rows[0];
            decimal pass = Static.ToDecimal(_drow["UPASSWORD"]);


            if (Static.ToLong(olpassword) != Static.ToLong(password))
            {
                if (Static.ToStr(_dr["ISSENDMAIL"]) == Static.ToStr(1))
                {
                    if (PassPolicy.ResultNo == 0)
                    {
                        _dr = PassPolicy.Data.Tables[0].Rows[0];
                        MailMessage msg = new MailMessage();
                        msg.From = new MailAddress(Static.ToStr(_dr["FROMUSER"]));
                        msg.To.Add(new MailAddress(Static.ToStr(obj[12]).ToLower()));
                        msg.Subject = obj[2] + " Таны нэвтрэх нэр, нууц үг";
                        object[] uspassword = (object[])ri.ReceivedParam[4];
                        for (int i = 0; i < uspassword.Length; i++)
                        {
                            msg.Body = "Таны нэвтрэх нэр, нууц үг\r\n\r\n\tХэрэглэгчийн дугаар: " + obj[0] + "\r\n\tНууц үг: " + uspassword[i];
                        }
                        SmtpClient smtp = new SmtpClient(Static.ToStr(_dr["SERVERNAME"]));
                        smtp.Credentials = new System.Net.NetworkCredential((Static.ToStr(_dr["MAILUSERNAME"])), (Static.ToStr(_dr["MAILUSERPASS"])));
                        smtp.Port        = Static.ToInt(_dr["SERVERPORT"]);
                        smtp.Send(msg);
                    }
                }
            }

            try
            {
                obj[0]  = value[0];  // UserNo
                obj[1]  = value[1];  //UserFname
                obj[2]  = value[2];  //UserLname
                obj[3]  = value[3];  //UserFname2
                obj[4]  = value[4];  //UserLname2
                obj[5]  = value[5];  //RegisterNo
                obj[6]  = value[6];  //Position
                obj[7]  = value[7];  //Status
                obj[8]  = value[8];  //BranchNo
                obj[9]  = value[9];  //UserLevel
                obj[10] = value[10]; //UPassword
                obj[11] = value[11]; //UserType
                obj[12] = value[12]; //Email
                obj[13] = value[13]; //Mobile
                obj[14] = value[14]; //Logintype
                obj[15] = value[15]; // WrongCount
                obj[16] = value[16]; //PassChangeDate
                obj[17] = value[17]; // AgentCorp
                obj[18] = value[18]; //AgentBranch

                if (value[19] != null)
                {
                    DataTable priv = (DataTable)value[19];
                    res = DBIO.DB203009(db, Static.ToInt(value[0]), priv);
                    if (res.ResultNo != 0)
                    {
                        return(res);
                    }
                }
                if (value[20] != null)
                {
                    DataTable sup = (DataTable)value[20];
                    res = DBIO.DB203010(db, Static.ToInt(value[0]), sup);
                    if (res.ResultNo != 0)
                    {
                        return(res);
                    }
                }
                res = DBIO.DB203007(db, obj);
                EServ.Shared.Static.WriteToLogFile("Error.log", "DB203007" + res.ResultNo.ToString() + res.ResultDesc);
                return(res);
            }
            catch (Exception ex)
            {
                res.ResultNo   = 9110002;
                res.ResultDesc = "Програм руу нэвтрэхэд алдаа гарлаа" + ex.Message;

                EServ.Shared.Static.WriteToLogFile("Error.log", ex.Message + ex.Source + ex.StackTrace);

                return(res);
            }
            finally
            {
                lg.item.Desc = "Хэрэглэгчийн мэдээлэл засварлах";
                object[] fieldValue = (object[])ri.ReceivedParam[1];
                object[] newValue   = (object[])ri.ReceivedParam[0];
                object[] oldValue   = (object[])ri.ReceivedParam[2];
                for (int i = 0; i < fieldValue.Length; i++)
                {
                    if (oldValue[i] != newValue[i])
                    {
                        lg.AddDetail("HPUSER", Static.ToStr(fieldValue[i]), Static.ToStr(oldValue[i]), Static.ToStr(newValue[i]));
                    }
                }
            }
        }
コード例 #2
0
        public Result Txn110102(ClientInfo ci, RequestInfo ri, DbConnections db, ref Log lg)
        {
            Result res = new Result();

            object[] value         = (object[])ri.ReceivedParam[0];
            object[] obj           = new object[19];
            string   DbIdErrorDesc = "Системд ийм дугаартай хэрэглэгч бүртгэгдсэн байна.";

            try
            {
                obj[0]  = value[0];  // UserNo
                obj[1]  = value[1];  //UserFname
                obj[2]  = value[2];  //UserLname
                obj[3]  = value[3];  //UserFname2
                obj[4]  = value[4];  //UserLname2
                obj[5]  = value[5];  //RegisterNo
                obj[6]  = value[6];  //Position
                obj[7]  = value[7];  //Status
                obj[8]  = value[8];  //BranchNo
                obj[9]  = value[9];  //UserLevel
                obj[10] = value[10]; //UPassword
                obj[11] = value[11]; //UserType
                obj[12] = value[12]; //Email
                obj[13] = value[13]; //Mobile
                obj[14] = value[14]; //Logintype
                obj[15] = value[15]; //wrongcount
                obj[16] = value[16]; //Pass Change date
                obj[17] = value[17]; //Agentcorp
                obj[18] = value[18]; //AgentBranch
                res     = DBIO.DB203006(db, obj);
                Result PassPolicy = new Result();
                PassPolicy = DBIO.DB216001(db);
                DataRow _dr;
                _dr = PassPolicy.Data.Tables[0].Rows[0];
                if (Static.ToStr(_dr["ISSENDMAIL"]) == Static.ToStr(1))
                {
                    if (PassPolicy.ResultNo == 0)
                    {
                        _dr = PassPolicy.Data.Tables[0].Rows[0];
                        MailMessage msg = new MailMessage();
                        msg.From = new MailAddress(Static.ToStr(_dr["FROMUSER"]));
                        msg.To.Add(new MailAddress(Static.ToStr(obj[12]).ToLower()));
                        msg.Subject = obj[2] + " Таны нэвтрэх нэр, нууц үг";
                        object[] upassword = (object[])ri.ReceivedParam[2];
                        for (int i = 0; i < upassword.Length; i++)
                        {
                            msg.Body = "Таны нэвтрэх нэр, нууц үг\r\n\r\n\tХэрэглэгчийн дугаар: " + obj[0] + "\r\n\tНууц үг: " + upassword[i];
                        }
                        SmtpClient smtp = new SmtpClient(Static.ToStr(_dr["SERVERNAME"]));
                        smtp.Credentials = new System.Net.NetworkCredential((Static.ToStr(_dr["MAILUSERNAME"])), (Static.ToStr(_dr["MAILUSERPASS"])));
                        smtp.Port        = Static.ToInt(_dr["SERVERPORT"]);
                        smtp.Send(msg);
                    }
                }
                if (res.ResultNo == 9110039)
                {
                    res.ResultNo   = 9110040;
                    res.ResultDesc = DbIdErrorDesc;
                    return(res);
                }

                if (value[19] != null)
                {
                    DataTable priv = (DataTable)value[19];
                    res = DBIO.DB203009(db, Static.ToInt(value[0]), priv);
                }
                if (value[20] != null)
                {
                    DataTable sup = (DataTable)value[20];
                    res = DBIO.DB203010(db, Static.ToInt(value[0]), sup);
                }
                return(res);
            }
            catch (Exception ex)
            {
                res.ResultNo   = 9110002;
                res.ResultDesc = "Програм руу нэвтрэхэд алдаа гарлаа" + ex.Message;

                EServ.Shared.Static.WriteToLogFile("Error.log", ex.Message + ex.Source + ex.StackTrace);

                return(res);
            }
            finally
            {
                lg.item.Desc = "Хэрэглэгч нэмэх";
                object[] fieldValue = (object[])ri.ReceivedParam[1];
                object[] newValue   = (object[])ri.ReceivedParam[0];
                for (int i = 0; i < fieldValue.Length; i++)
                {
                    lg.AddDetail("HPUSER", Static.ToStr(fieldValue[i]), "Хэрэглэгч нэмэх", Static.ToStr(newValue[i]));
                }
            }
        }