Ejemplo n.º 1
0
 public List<Maticsoft.Email.Model.MailConfig> DataTableToList(DataTable dt)
 {
     List<Maticsoft.Email.Model.MailConfig> list = new List<Maticsoft.Email.Model.MailConfig>();
     int count = dt.Rows.Count;
     if (count > 0)
     {
         for (int i = 0; i < count; i++)
         {
             Maticsoft.Email.Model.MailConfig item = new Maticsoft.Email.Model.MailConfig();
             if (dt.Rows[i]["ID"].ToString() != "")
             {
                 item.ID = int.Parse(dt.Rows[i]["ID"].ToString());
             }
             if (dt.Rows[i]["UserID"].ToString() != "")
             {
                 item.UserID = int.Parse(dt.Rows[i]["UserID"].ToString());
             }
             item.Mailaddress = dt.Rows[i]["Mailaddress"].ToString();
             item.Username = dt.Rows[i]["Username"].ToString();
             item.Password = dt.Rows[i]["Password"].ToString();
             item.SMTPServer = dt.Rows[i]["SMTPServer"].ToString();
             if (dt.Rows[i]["SMTPPort"].ToString() != "")
             {
                 item.SMTPPort = int.Parse(dt.Rows[i]["SMTPPort"].ToString());
             }
             if (dt.Rows[i]["SMTPSSL"].ToString() != "")
             {
                 item.SMTPSSL = dt.Rows[i]["SMTPSSL"].ToString() == "1";
             }
             item.POPServer = dt.Rows[i]["POPServer"].ToString();
             if (dt.Rows[i]["POPPort"].ToString() != "")
             {
                 item.POPPort = int.Parse(dt.Rows[i]["POPPort"].ToString());
             }
             if (dt.Rows[i]["POPSSL"].ToString() != "")
             {
                 item.POPSSL = dt.Rows[i]["POPSSL"].ToString() == "1";
             }
             list.Add(item);
         }
     }
     return list;
 }
Ejemplo n.º 2
0
 public Maticsoft.Email.Model.MailConfig GetModel()
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select   ID,UserID,Mailaddress,Username,Password,SMTPServer,SMTPPort,SMTPSSL,POPServer,POPPort,POPSSL from Accounts_MailConfig  LIMIT 1");
     Maticsoft.Email.Model.MailConfig config = new Maticsoft.Email.Model.MailConfig();
     DataSet set = DbHelperMySQL.Query(builder.ToString());
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["ID"].ToString() != "")
     {
         config.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString());
     }
     if (set.Tables[0].Rows[0]["UserID"].ToString() != "")
     {
         config.UserID = int.Parse(set.Tables[0].Rows[0]["UserID"].ToString());
     }
     config.Mailaddress = set.Tables[0].Rows[0]["Mailaddress"].ToString();
     config.Username = set.Tables[0].Rows[0]["Username"].ToString();
     config.Password = set.Tables[0].Rows[0]["Password"].ToString();
     config.SMTPServer = set.Tables[0].Rows[0]["SMTPServer"].ToString();
     if (set.Tables[0].Rows[0]["SMTPPort"].ToString() != "")
     {
         config.SMTPPort = int.Parse(set.Tables[0].Rows[0]["SMTPPort"].ToString());
     }
     if (set.Tables[0].Rows[0]["SMTPSSL"].ToString() != "")
     {
         config.SMTPSSL = set.Tables[0].Rows[0]["SMTPSSL"].ToString() == "1";
     }
     config.POPServer = set.Tables[0].Rows[0]["POPServer"].ToString();
     if (set.Tables[0].Rows[0]["POPPort"].ToString() != "")
     {
         config.POPPort = int.Parse(set.Tables[0].Rows[0]["POPPort"].ToString());
     }
     if (set.Tables[0].Rows[0]["POPSSL"].ToString() != "")
     {
         config.POPSSL = set.Tables[0].Rows[0]["POPSSL"].ToString() == "1";
     }
     return config;
 }
Ejemplo n.º 3
0
 public Maticsoft.Email.Model.MailConfig GetModel(int ID)
 {
     StringBuilder builder = new StringBuilder();
     builder.Append("select   ID,UserID,Mailaddress,Username,Password,SMTPServer,SMTPPort,SMTPSSL,POPServer,POPPort,POPSSL from Accounts_MailConfig ");
     builder.Append(" where ID=?ID LIMIT 1");
     MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("?ID", MySqlDbType.Int32, 4) };
     cmdParms[0].Value = ID;
     Maticsoft.Email.Model.MailConfig config = new Maticsoft.Email.Model.MailConfig();
     DataSet set = DbHelperMySQL.Query(builder.ToString(), cmdParms);
     if (set.Tables[0].Rows.Count <= 0)
     {
         return null;
     }
     if (set.Tables[0].Rows[0]["ID"].ToString() != "")
     {
         config.ID = int.Parse(set.Tables[0].Rows[0]["ID"].ToString());
     }
     if (set.Tables[0].Rows[0]["UserID"].ToString() != "")
     {
         config.UserID = int.Parse(set.Tables[0].Rows[0]["UserID"].ToString());
     }
     config.Mailaddress = set.Tables[0].Rows[0]["Mailaddress"].ToString();
     config.Username = set.Tables[0].Rows[0]["Username"].ToString();
     config.Password = set.Tables[0].Rows[0]["Password"].ToString();
     config.SMTPServer = set.Tables[0].Rows[0]["SMTPServer"].ToString();
     if (set.Tables[0].Rows[0]["SMTPPort"].ToString() != "")
     {
         config.SMTPPort = int.Parse(set.Tables[0].Rows[0]["SMTPPort"].ToString());
     }
     if (set.Tables[0].Rows[0]["SMTPSSL"].ToString() != "")
     {
         config.SMTPSSL = set.Tables[0].Rows[0]["SMTPSSL"].ToString() == "1";
     }
     config.POPServer = set.Tables[0].Rows[0]["POPServer"].ToString();
     if (set.Tables[0].Rows[0]["POPPort"].ToString() != "")
     {
         config.POPPort = int.Parse(set.Tables[0].Rows[0]["POPPort"].ToString());
     }
     if (set.Tables[0].Rows[0]["POPSSL"].ToString() != "")
     {
         config.POPSSL = set.Tables[0].Rows[0]["POPSSL"].ToString() == "1";
     }
     return config;
 }