コード例 #1
0
 protected void imgbtn4_Click(object sender, ImageClickEventArgs e)
 {
     ModalPopupExtender5.Hide();
 }
コード例 #2
0
    protected void RegisterBtn_Click(object sender, ImageClickEventArgs e)
    {
        if (ddlcountry.SelectedIndex == 0)
        {
            Label2.Text = "Please select country";
            return;
        }
        if (ddlstate.SelectedIndex == 0)
        {
            Label2.Text = "Please select state";
            return;
        }
        if (ddlcity.SelectedIndex == 0)
        {
            Label2.Text = "Please select City";
            return;
        }
        Label2.Text = "";
        ImageButton10_Click(sender, e);
        if (Convert.ToInt32(ViewState["not"]) == 1)
        {
            return;
        }
        if (CheckBox1.Checked == true)
        {
            int            accid = 10000;
            SqlDataAdapter ad5   = new SqlDataAdapter("SELECT     AccountId " +
                                                      "   FROM         AccountMaster " +
                                                      //  " WHERE     (AccountId < 30000 AND AccountId > 10000) AND Whid='"+Session["WH"]+"' order by AccountId desc", con);
                                                      " WHERE     (AccountId < 30000 AND AccountId > 10000) AND Whid='" + ddlstorename.SelectedValue + "' order by AccountId desc", con);
            DataTable ds1125 = new DataTable();
            ad5.Fill(ds1125);
            if (ds1125.Rows.Count > 0)
            {
                accid = Convert.ToInt32(ds1125.Rows[0]["AccountId"]) + 1;
            }
            else
            {
            }

            string st = " insert into AccountMaster(ClassId,GroupId,AccountName,Description,Balance,Date,InventoryFlag,BalanceOfLastYear,DateTimeOfLastUpdatedBalance,Status,compid,Whid) " +
                        " values ('1','10','New Customer','new Order From Online Shopping','0','" + System.DateTime.Now.ToShortDateString() + "','0','0','" + System.DateTime.Now.ToShortDateString() + "',1,'" + Session["comid"] + "','" + ddlstorename.SelectedValue + "')";
            SqlCommand cm = new SqlCommand(st, con);
            con.Open();
            cm.ExecuteNonQuery();
            con.Close();


            //SqlDataAdapter ad = new SqlDataAdapter("select max(AccountId) as account from AccountMaster where Whid='" + ddlstorename.SelectedValue + "'", con);
            SqlDataAdapter ad    = new SqlDataAdapter("select max(AccountId) as AccountId from AccountMaster where Whid='" + ddlstorename.SelectedValue + "'", con);
            DataSet        ds112 = new DataSet();
            ad.Fill(ds112);


            ViewState["AccountId"] = ds112.Tables[0].Rows[0]["AccountId"].ToString();

            string stbllim = " INSERT INTO AccountBalanceLimit (AccountId ,BalanceLimitTypeId  ,BalancelimitAmount,DateTime,Whid) " +
                             " VALUES(" + accid + ",'2','500','" + System.DateTime.Today.ToString("MM/dd/yyyy") + "','" + ddlstorename.SelectedValue + "' )   ";
            SqlCommand cmbllim = new SqlCommand(stbllim, con);
            con.Open();
            cmbllim.ExecuteNonQuery();
            con.Close();



            SqlConnection conn3 = new SqlConnection(strconn);
            string        ins1  = "insert into Party_master(Account,Compname,Contactperson,Address,City,State,Country,Website,GSTno,Incometaxno,Email,Phoneno,DataopID,PartyTypeId,AssignedAccountManagerId,AssignedRecevingDepartmentInchargeId,AssignedPurchaseDepartmentInchargeId,AssignedShippingDepartmentInchargeId,AssignedSalesDepartmentIncharge,StatusMasterId,Fax,AccountnameID,id,Whid) values ( '" + Convert.ToInt32(ds112.Tables[0].Rows[0]["AccountId"]) + "','" + txtfirstname.Text + "','" + txtfirstname.Text + "','" + txtaddress.Text + "','" + ddlcity.Text + "','" + ddlstate.SelectedValue + "','" + ddlcountry.SelectedValue + "','indiaauthentic', '1' ,'1','" + txtemail.Text + "','" + txtphoneno.Text + "','1', '2' ,'1' ,'1' , '1' , '1' , '1' ,'5' , '1' , '1','" + Session["comid"] + "','" + ddlstorename.SelectedValue + "' )";
            SqlCommand    cmd3  = new SqlCommand(ins1);
            cmd3.Connection = conn3;
            conn3.Open();
            cmd3.ExecuteNonQuery();

            SqlConnection conn5 = new SqlConnection(strconn);
            string        sel   = "select max(PartyID) as PartyID from Party_master where Whid='" + ddlstorename.SelectedValue + "'";
            SqlCommand    cmd5  = new SqlCommand(sel);
            cmd5.Connection = conn5;
            SqlDataAdapter da5 = new SqlDataAdapter();
            da5.SelectCommand = cmd5;
            DataSet ds5 = new DataSet();
            da5.Fill(ds5, "Party_master");

            SqlConnection conn6 = new SqlConnection(strconn);
            string        ins6  = "insert into User_master(Name,Address,City,State,Country,Phoneno,EmailID,Username,Department,Accesslevel,PartyID,DesigantionMasterId,Photo,Active,Extention,zipcode) values ('" + txtlastname.Text + " " + txtfirstname.Text + "','" + txtaddress.Text + "','" + ddlcity.SelectedValue + "','" + ddlstate.SelectedValue + "','" + ddlcountry.SelectedValue + "','" + txtphoneno.Text + "','" + txtemail.Text + "','" + txtemail.Text + "','1','1','" + Convert.ToInt32(ds5.Tables[0].Rows[0]["PartyId"]) + "','57','PP','true','1','" + txtzip.Text + "')";
            SqlCommand    cmd6  = new SqlCommand(ins6);
            cmd6.Connection = conn6;
            conn6.Open();
            cmd6.ExecuteNonQuery();


            SqlConnection conn10 = new SqlConnection(strconn);
            string        sel11  = "select max(UserID) as UserID from User_master";
            SqlCommand    cmd10  = new SqlCommand(sel11);
            cmd10.Connection = conn10;
            SqlDataAdapter da10 = new SqlDataAdapter();
            da10.SelectCommand = cmd10;
            DataSet ds10 = new DataSet();
            da10.Fill(ds10, "User_master");


            SqlConnection conn9 = new SqlConnection(strconn);
            string        ins7  = "insert into Login_master(UserID,username,password,department,accesslevel,deptid,accessid) values ('" + Convert.ToInt32(ds10.Tables[0].Rows[0]["UserID"]) + "','" + txtemail.Text + "','" + txtpassword.Text + "','1','1','57','1')";
            SqlCommand    cmd9  = new SqlCommand(ins7);
            cmd9.Connection = conn9;
            conn9.Open();
            cmd9.ExecuteNonQuery();
            //sendmail(txtemail.Text);

            SqlConnection conn = new SqlConnection(strconn);

            string     str11 = "select max(UserID) as userid from Login_master";
            SqlCommand cmd11 = new SqlCommand(str11, conn);
            //cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter adp11 = new SqlDataAdapter(cmd11);
            DataTable      ds11  = new DataTable();
            adp11.Fill(ds11);

            Session["userid"]   = ds11.Rows[0]["userid"].ToString();
            Session["username"] = txtemail.Text;



            SqlCommand cmd = new SqlCommand("SELECT UserID,Name FROM dbo.User_master inner join Party_master ON User_master.PartyID = Party_master.PartyID where Party_master.id='" + Session["comid"] + "' and Party_master.Whid='" + ddlstorename.SelectedValue + "' order by Name", con);
            cmd.CommandType = CommandType.Text;
            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataSet        ds  = new DataSet();
            adp.Fill(ds);

            ddlUserMaster.DataSource     = ds;
            ddlUserMaster.DataTextField  = "Name";
            ddlUserMaster.DataValueField = "UserID";
            ddlUserMaster.DataBind();
            ddlUserMaster.Items.Insert(0, "--Select--");
            ddlUserMaster.SelectedItem.Value = "0";
        }
        else
        {
            Label2.Text = "Please accept The terms & conditions.";
        }
        ModalPopupExtender5.Hide();
        Label1.Text = "";
    }