예제 #1
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            _AdminUser au;
            char       sex    = 'x';
            int        lastID = 1;

            if (rblSex.SelectedValue == "Male")
            {
                sex = 'M';
            }
            else if (rblSex.SelectedValue == "Female")
            {
                sex = 'F';
            }

            if (txtEmail.Text != "" && txtFirst.Text != "" && txtLast.Text != "" && txtMiddle.Text != "" && txtMobileNo.Text != "" && txtPass.Text != "" && txtRePass.Text != "" && txtUsername.Text != "" && sex == 'M' || sex == 'F')
            {
                if (picUpload.HasFile)
                {
                    lastID += SQLManager.SQLLastID();
                    string strname = picUpload.FileName.ToString();
                    string ext     = Path.GetExtension(strname).ToLower();

                    if (ext == ".jpeg" || ext == ".jpg" || ext == ".gif" || ext == ".png")
                    {
                        picUpload.PostedFile.SaveAs(Server.MapPath("/images/users/") + lastID + ext);
                    }
                }
                au = new _AdminUser(txtLast.Text, txtFirst.Text, txtMiddle.Text, txtMobileNo.Text, txtEmail.Text, txtUsername.Text, txtPass.Text, ddlRole.SelectedValue, sex);
                SQLManager.SQLAdd(au);
                Clear();
            }
        }
예제 #2
0
        public List <smsMoInfo> GetSmsList(string sql, string sql_c, out int Count)
        {
            List <smsMoInfo> ls = new List <smsMoInfo>();

            int LogCount = 1;

            try
            {
                LogCount = Convert.ToInt32(helper.GetOne(sql_c));
            }
            catch
            {
                LogCount = 1;
            }
            Count = LogCount;

            using (DataTable dt = helper.GetDataTable(sql))
            {
                if (dt != null && dt.Rows.Count > 0)
                {
                    Dictionary <int, string>     Dic   = new _AdminUser().GetAdminUserDic();
                    Dictionary <int, smsChannel> Dic_C = new _SmsChannel().GetSmsChannelDic();
                    try
                    {
                        foreach (DataRow r in dt.Rows)
                        {
                            smsMoInfo l = new smsMoInfo
                            {
                                AddOn       = Convert.ToDateTime(r["addOn"]),
                                Content     = r["content"].ToString(),
                                AdminID     = Convert.ToInt16(r["AdminID"]),
                                AdminName   = "",
                                Mobile      = r["Mobile"].ToString(),
                                ChannelID   = Convert.ToInt16(r["ChannelID"]),
                                ChannelName = ""
                            };
                            if (Dic.ContainsKey(l.AdminID))
                            {
                                l.AdminName = Dic[l.AdminID];
                            }
                            if (Dic_C.ContainsKey(l.ChannelID))
                            {
                                l.ChannelName = Dic_C[l.ChannelID].ChannelName;
                            }
                            ls.Add(l);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            return(ls);
        }
예제 #3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            _AdminUser au;
            _Branch    b;
            char       sex    = 'x';
            int        lastID = 1;

            if (rblSex.SelectedValue == "Male")
            {
                sex = 'M';
            }
            else if (rblSex.SelectedValue == "Female")
            {
                sex = 'F';
            }

            if (txtEmail.Text != "" && txtFirst.Text != "" && txtLast.Text != "" && txtMiddle.Text != "" && txtMobileNo.Text != "" && txtPass.Text != "" && txtRePass.Text != "" && txtUsername.Text != "" && sex == 'M' || sex == 'F')
            {
                if (picUpload.HasFile)
                {
                    lastID += SQLManager.SQLLastID();
                    string strname = picUpload.FileName.ToString();
                    string ext     = Path.GetExtension(strname).ToLower();

                    if (ext == ".jpeg" || ext == ".jpg" || ext == ".gif" || ext == ".png")
                    {
                        picUpload.PostedFile.SaveAs(Server.MapPath("/images/users/") + lastID + ext);
                    }
                }
                au = new _AdminUser(txtLast.Text, txtFirst.Text, txtMiddle.Text, txtMobileNo.Text, txtEmail.Text, txtUsername.Text, txtPass.Text, "Branch Manager", sex);
                b  = new _Branch(lastID++);
                SQLManager.SQLAdd(au);

                int    uID      = Convert.ToInt32(Session["ID"]);
                string location = ddlAssign.SelectedItem.ToString();
                int    bID      = -1;


                var    cs         = ConfigurationManager.ConnectionStrings["ZoomDB"];
                string connection = cs.ConnectionString;

                SqlConnection  sqlconnect = new SqlConnection(connection);
                SqlDataAdapter adapt      = new SqlDataAdapter("Select * from BRANCH", sqlconnect);
                DataSet        dsReq      = new DataSet();

                adapt.Fill(dsReq, "BRANCH");
                DataTable tblReq;
                tblReq = dsReq.Tables["BRANCH"];

                foreach (DataRow row in tblReq.Rows)
                {
                    if ((location == row["location"].ToString()) && (uID == Convert.ToInt32(row["BR_OWNERID"].ToString())))
                    {
                        bID = Convert.ToInt32(row["id"].ToString());
                        break;
                    }
                }
                SQLManager.SQLAddBranchManager(b, bID);
                Clear();
            }
        }