Ejemplo n.º 1
0
        void btn_Click(object sender, EventArgs e)
        {
            Button tbtn = (Button)sender;
            string name = tbtn.Name.ToString();

            if (name == "save")
            {
                if (validate() == true)
                {
                    //save();
                    //create
                    UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();
                    if (ob != null && gStr == "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }

                    //alter
                    ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
                    if (ob != null && gStr != "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }
                }
            }
            else if (name == "quit")
            {
                this.Close();
                this.Dispose();
            }
        }
Ejemplo n.º 2
0
        void tb_TextChanged(object sender, EventArgs e)
        {
            TextBox tb      = (TextBox)sender;
            string  pageid  = tb.Tag.ToString().Split(';')[0];
            string  feature = tb.Tag.ToString().Split(';')[1];

            DataRow dtr = dtpagesroleTobeSaved.Select("Page_Id=" + pageid).FirstOrDefault();

            if (dtr == null)
            {
                return;
            }

            string str = dtr["Feature"].ToString();
            List <UsersFeature>  objlist = new List <UsersFeature>();
            JavaScriptSerializer obj     = new JavaScriptSerializer();

            objlist = obj.Deserialize <List <UsersFeature> >(str);
            UsersFeature ob = objlist.Where(w => w.FeatureName == feature).FirstOrDefault();

            if (ob != null)
            {
                ob.SelectedValue = tb.Text;
            }

            dtr["Feature"] = obj.Serialize(objlist);
        }
Ejemplo n.º 3
0
        private void frm_container_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                this.Close();
                this.Dispose();
            }
            else if (e.Control && e.KeyCode == Keys.S)
            {
                if (validate() == true)
                {
                    //create
                    UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();
                    if (ob != null && gstr == "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }

                    //alter
                    ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
                    if (ob != null && gstr != "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }
                    //if (Database.utype.ToUpper() == "SUPERADMIN" || Database.utype.ToUpper() == "ADMIN")
                    //{
                    //    save();
                    //}
                    //else if (gstr == "0")
                    //{
                    //    save();
                    //}
                }
            }
        }
Ejemplo n.º 4
0
        private void frmnewgroup_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.S)
            {
                if (validate() == true)
                {
                    //create
                    UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();
                    if (ob != null && gStr == "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }

                    //alter
                    ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
                    if (ob != null && gStr != "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }

                    if (gStr == "0")
                    {
                        LoadData("0", this.Text);
                    }
                    else
                    {
                        this.Close();
                        this.Dispose();
                    }
                    if (calledIndirect == true)
                    {
                        this.Close();
                        this.Dispose();
                    }
                }
            }
            else
            {
                textBox1.BackColor = Color.White;
            }
            if (e.KeyCode == Keys.Escape)
            {
                if (textBox1.Text != "")
                {
                    DialogResult chk = MessageBox.Show("Are u sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (chk == DialogResult.No)
                    {
                        e.Handled = false;
                    }
                    else
                    {
                        this.Dispose();
                    }
                }
                else
                {
                    this.Dispose();
                }
            }
        }
Ejemplo n.º 5
0
        private void frm_packcat_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.S)
            {
                if (validate() == true)
                {
                    //create
                    UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();
                    if (ob != null && gStr == "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }

                    //alter
                    ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
                    if (ob != null && gStr != "0" && ob.SelectedValue == "Allowed")
                    {
                        save();
                    }
                }
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.Close();
                this.Dispose();
            }
        }
        private void Frm_ProductFormula_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Control && e.KeyCode == Keys.S)
            {
                if (validate() == true)
                {
                    //create
                    UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();
                    if (ob != null && gStr == "0" && ob.SelectedValue == "Allowed")
                    {
                        Save();
                    }

                    //alter
                    ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
                    if (ob != null && gStr != "0" && ob.SelectedValue == "Allowed")
                    {
                        Save();
                    }

                    //if (Database.utype.ToUpper() == "SUPERADMIN" || Database.utype.ToUpper() == "ADMIN")
                    //{
                    //    Save();
                    //}

                    //else if (gStr == "0")
                    //{
                    //    Save();
                    //}
                }
            }

            else if (e.KeyCode == Keys.Escape)
            {
                if (textBox1.Text != "")
                {
                    DialogResult chk = MessageBox.Show("Are u sure?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                    if (chk == DialogResult.No)
                    {
                        e.Handled = false;
                    }
                    else
                    {
                        this.Close();
                        this.Dispose();
                    }
                }
                else
                {
                    this.Close();
                    this.Dispose();
                }
            }
        }
Ejemplo n.º 7
0
        private void SideFill()
        {
            flowLayoutPanel1.Controls.Clear();
            DataTable dtsidefill = new DataTable();

            dtsidefill.Columns.Add("Name", typeof(string));
            dtsidefill.Columns.Add("DisplayName", typeof(string));
            dtsidefill.Columns.Add("ShortcutKey", typeof(string));
            dtsidefill.Columns.Add("Visible", typeof(bool));
            //save
            dtsidefill.Rows.Add();
            dtsidefill.Rows[0]["Name"]        = "save";
            dtsidefill.Rows[0]["DisplayName"] = "Save";
            dtsidefill.Rows[0]["ShortcutKey"] = "^S";
            permission = funs.GetPermissionKey("User");
            //create
            UsersFeature ob = permission.Where(w => w.FeatureName == "Create").FirstOrDefault();

            if (ob != null && gStr == "0" && ob.SelectedValue == "Allowed")
            {
                dtsidefill.Rows[0]["Visible"] = true;
            }
            else if (gStr == "0")
            {
                dtsidefill.Rows[0]["Visible"] = false;
            }

            //alter
            ob = permission.Where(w => w.FeatureName == "Alter").FirstOrDefault();
            if (ob != null && gStr != "0" && ob.SelectedValue == "Allowed")
            {
                dtsidefill.Rows[0]["Visible"] = true;
            }
            else if (gStr != "0")
            {
                dtsidefill.Rows[0]["Visible"] = false;
            }


            //close
            dtsidefill.Rows.Add();
            dtsidefill.Rows[1]["Name"]        = "quit";
            dtsidefill.Rows[1]["DisplayName"] = "Quit";
            dtsidefill.Rows[1]["ShortcutKey"] = "Esc";
            dtsidefill.Rows[1]["Visible"]     = true;

            for (int i = 0; i < dtsidefill.Rows.Count; i++)
            {
                if (bool.Parse(dtsidefill.Rows[i]["Visible"].ToString()) == true)
                {
                    Button btn = new Button();
                    btn.Size = new Size(150, 30);
                    btn.Name = dtsidefill.Rows[i]["Name"].ToString();
                    btn.Text = "";
                    Bitmap   bmp = new Bitmap(btn.ClientRectangle.Width, btn.ClientRectangle.Height);
                    Graphics G   = Graphics.FromImage(bmp);
                    G.Clear(btn.BackColor);
                    string       line1 = dtsidefill.Rows[i]["ShortcutKey"].ToString();
                    string       line2 = dtsidefill.Rows[i]["DisplayName"].ToString();
                    StringFormat SF    = new StringFormat();
                    SF.Alignment     = StringAlignment.Near;
                    SF.LineAlignment = StringAlignment.Center;
                    Rectangle RC   = btn.ClientRectangle;
                    Font      font = new Font("Arial", 12);
                    G.DrawString(line1, font, Brushes.Red, RC, SF);
                    G.DrawString("".PadLeft(line1.Length * 2 + 1) + line2, font, Brushes.Black, RC, SF);
                    btn.Image  = bmp;
                    btn.Click += new EventHandler(btn_Click);
                    flowLayoutPanel1.Controls.Add(btn);
                }
            }
        }
Ejemplo n.º 8
0
        private void Sendsms(string vid)
        {
            permission = funs.GetPermissionKey("SMS Setup");

            UsersFeature ob = permission.Where(w => w.FeatureName == "Send SMS").FirstOrDefault();

            if (ob != null && ob.SelectedValue == "No")
            {
                return;
            }
            else if (ob != null && ob.SelectedValue == "Ask")
            {
                if (MessageBox.Show("Are you want to send SMS?", "SMS", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }


            string    vt_id     = Database.GetScalarText("Select vt_id from Voucherinfo where vi_id='" + vid + "'");
            string    gtype     = Database.GetScalarText("Select type from Vouchertype where vt_id='" + vt_id + "'");
            DataTable dtcompany = new DataTable();

            Database.GetSqlData("Select name , Address1,address2 from Company", dtcompany);
            if (gtype == "Sale" || gtype == "Return")
            {
                string ac_id = Database.GetScalarText("Select Ac_id from Voucherinfo where Vi_id='" + vid + "'");

                if (funs.Select_AccTypeids(ac_id) != "SER3")
                {
                    if (funs.Select_Mobile(funs.Select_ac_nm(ac_id)) != "0")
                    {
                        DataTable dtcontent = new DataTable();
                        Database.GetSqlData("SELECT VOUCHERTYPE.Name, VOUCHERINFO.Invoiceno, VOUCHERINFO.Vdate, VOUCHERINFO.Totalamount as amount FROM VOUCHERINFO LEFT OUTER JOIN  VOUCHERTYPE ON VOUCHERINFO.Vt_id = VOUCHERTYPE.Vt_id WHERE ( VOUCHERINFO.Vi_id = '" + vid + "')", dtcontent);



                        if (dtcontent.Rows.Count > 0)
                        {
                            double bal   = Database.GetScalarDecimal("SELECT SUM(Balance) AS Balance FROM    (SELECT     Balance+Balance2 as Balance FROM          dbo.ACCOUNT  WHERE      (Ac_id = '" + ac_id + "') UNION ALL  SELECT     SUM(dbo.Journal.Amount) AS SumOfAmount  FROM         dbo.VOUCHERINFO LEFT OUTER JOIN  dbo.Journal ON dbo.VOUCHERINFO.Vi_id = dbo.Journal.Vi_id  WHERE     (dbo.Journal.Ac_id = '" + ac_id + "') AND (dbo.Journal.Vdate <= " + access_sql.Hash + DateTime.Parse(dtcontent.Rows[0]["vdate"].ToString()).ToString(Database.dformat) + access_sql.Hash + ")  AND (dbo.Journal.AB = 'true')) AS res");
                            string balan = "";
                            if (bal == 0)
                            {
                                balan = "0";
                            }
                            else if (bal > 0)
                            {
                                balan = bal.ToString() + " Dr.";
                            }
                            else
                            {
                                balan = (-1 * bal).ToString() + " Cr.";
                            }


                            string msg = "Dear Sir, " + dtcontent.Rows[0]["Name"].ToString() + " No: " + dtcontent.Rows[0]["Invoiceno"].ToString() + " Dated: " + DateTime.Parse(dtcontent.Rows[0]["Vdate"].ToString()).ToString(Database.dformat) + ", Amt: " + funs.IndianCurr(double.Parse(dtcontent.Rows[0]["Amount"].ToString())) + ", Current Bal is: " + balan + ", from " + dtcompany.Rows[0]["Name"].ToString() + " " + dtcompany.Rows[0]["Address2"].ToString();

                            msg = msg.Replace("\r", "");

                            if (funs.isDouble(funs.Select_Mobile(funs.Select_ac_nm(ac_id))) == true)
                            {
                                sms objsms = new sms();
                                //MessageBox.Show(msg);
                                objsms.send(msg, funs.Select_Mobile(funs.Select_ac_nm(ac_id)), funs.Select_ac_nm(ac_id));
                            }
                        }
                    }
                }
            }
            else if (gtype == "Receipt" || gtype == "Cnote")
            {
                DataTable dtcontent = new DataTable();
                Database.GetSqlData("SELECT VOUCHERTYPE.Name, VOUCHERINFO.Invoiceno, VOUCHERINFO.Vdate, VOUCHERACTOTAL.Accid, VOUCHERACTOTAL.Amount FROM VOUCHERINFO LEFT OUTER JOIN   VOUCHERTYPE ON VOUCHERINFO.Vt_id = VOUCHERTYPE.Vt_id LEFT OUTER JOIN   VOUCHERACTOTAL ON VOUCHERINFO.Vi_id = VOUCHERACTOTAL.Vi_id WHERE VOUCHERINFO.Vi_id = '" + vid + "'", dtcontent);
                for (int k = 0; k < dtcontent.Rows.Count; k++)
                {
                    string ac_id = dtcontent.Rows[k]["Accid"].ToString();

                    if (funs.Select_AccTypeids(ac_id) != "SER3")
                    {
                        if (funs.Select_Mobile(funs.Select_ac_nm(ac_id)) != "0")
                        {
                            double bal   = Database.GetScalarDecimal("SELECT SUM(Balance) AS Balance FROM         (SELECT     Balance+Balance2 as Balance FROM          dbo.ACCOUNT  WHERE      (Ac_id = '" + ac_id + "') UNION ALL  SELECT     SUM(dbo.Journal.Amount) AS SumOfAmount  FROM         dbo.VOUCHERINFO LEFT OUTER JOIN  dbo.Journal ON dbo.VOUCHERINFO.Vi_id = dbo.Journal.Vi_id  WHERE     (dbo.Journal.Ac_id = '" + ac_id + "') AND (dbo.Journal.Vdate <= " + access_sql.Hash + DateTime.Parse(dtcontent.Rows[0]["vdate"].ToString()).ToString(Database.dformat) + access_sql.Hash + ")  AND (dbo.Journal.AB = 'true')) AS res");
                            string balan = "";

                            if (bal == 0)
                            {
                                balan = "0";
                            }
                            else if (bal > 0)
                            {
                                balan = bal.ToString() + " Dr.";
                            }
                            else
                            {
                                balan = (-1 * bal).ToString() + " Cr.";
                            }


                            // string msg = "Dear Sir, " + dtcontent.Rows[0]["Type"].ToString() + ",Invoice No:" + dtcontent.Rows[0]["Invoiceno"].ToString() + ",Invoice Date:" + DateTime.Parse(dtcontent.Rows[0]["Vdate"].ToString()).ToString(Database.dformat) + ",Invoice Amt: " + funs.IndianCurr(double.Parse(dtcontent.Rows[0]["Amount"].ToString())) + ",Now Current Bal is: " + balan + ", from " + dtcompany.Rows[0]["Name"].ToString() + " " + dtcompany.Rows[0]["Address1"].ToString() + " " + dtcompany.Rows[0]["Address2"].ToString();
                            string msg = "Dear Sir, " + dtcontent.Rows[0]["Name"].ToString() + " No: " + dtcontent.Rows[0]["Invoiceno"].ToString() + " Dated: " + DateTime.Parse(dtcontent.Rows[0]["Vdate"].ToString()).ToString(Database.dformat) + ", Amt: " + funs.IndianCurr(double.Parse(dtcontent.Rows[0]["Amount"].ToString())) + ", Current Bal is: " + balan + ", from " + dtcompany.Rows[0]["Name"].ToString() + " " + dtcompany.Rows[0]["Address2"].ToString();

                            msg = msg.Replace("\r", "");

                            if (funs.isDouble(funs.Select_Mobile(funs.Select_ac_nm(ac_id))) == true)
                            {
                                sms objsms = new sms();
                                // MessageBox.Show(msg);
                                objsms.send(msg, funs.Select_Mobile(funs.Select_ac_nm(ac_id)), funs.Select_ac_nm(ac_id));
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 9
0
        void btn_Click(object sender, EventArgs e)
        {
            Button tbtn = (Button)sender;
            string name = tbtn.Name.ToString();

            if (name == "send")
            {
                permission = funs.GetPermissionKey("SMS Setup");

                UsersFeature ob = permission.Where(w => w.FeatureName == "Send SMS").FirstOrDefault();

                if (ob != null && ob.SelectedValue == "No")
                {
                    return;
                }
                else if (ob != null && ob.SelectedValue == "Ask")
                {
                    if (MessageBox.Show("Are you want to send SMS?", "SMS", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
                    {
                        return;
                    }
                }


                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (bool.Parse(dataGridView1.Rows[i].Cells["check"].Value.ToString()) == true && (dataGridView1.Rows[i].Cells["phone"].Value.ToString() != "0" && dataGridView1.Rows[i].Cells["phone"].Value.ToString() != ""))
                    {
                        DataTable dtSmsInfo = new DataTable();
                        Database.GetSqlData("select * from smssetup", dtSmsInfo);
                        string AuthKey  = "";
                        string SenderID = "";
                        string Footer   = "";
                        if (dtSmsInfo.Rows.Count > 0)
                        {
                            AuthKey  = dtSmsInfo.Rows[0]["uid"].ToString();
                            SenderID = dtSmsInfo.Rows[0]["sender"].ToString();
                            Footer   = dtSmsInfo.Rows[0]["pin"].ToString();
                            Footer   = Footer.Replace(" ", "%20");
                            Footer   = Footer.Replace("(", "%28");
                            Footer   = Footer.Replace("(", "%29");
                            Footer   = Footer.Replace(",", "%2C");
                            Footer   = Footer.Replace(":", "%3a");
                        }
                        else
                        {
                            return;
                        }

                        string gmatter = textBox1.Text;
                        gmatter = gmatter.Replace("{Amount}", funs.IndianCurr(double.Parse(dataGridView1.Rows[i].Cells["balance"].Value.ToString())));
                        gmatter = gmatter.Replace("\r", "");
                        gmatter = gmatter.Replace(" ", "%20");
                        gmatter = gmatter.Replace("(", "%28");
                        gmatter = gmatter.Replace("(", "%29");
                        gmatter = gmatter.Replace(",", "%2C");
                        gmatter = gmatter.Replace("\n", "%0A");
                        gmatter = gmatter.Replace(":", "%3a");


                        if (funs.isDouble(dataGridView1.Rows[i].Cells["phone"].Value.ToString()) == true)
                        {
                            if (dataGridView1.Rows[i].Cells["phone"].Value.ToString() != "0")
                            {
                                sms objsms = new sms();
                                objsms.send(gmatter, dataGridView1.Rows[i].Cells["phone"].Value.ToString(), dataGridView1.Rows[i].Cells["Cname"].Value.ToString());
                            }
                        }
                    }
                }
            }


            else if (name == "quit")
            {
                this.Close();
                this.Dispose();
            }
        }