private void button1_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure, Do you want to Generate...?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                int     gensubs = 0;
                DataSet ds      = db.GetTableData("select * from mas_sub_pay_details where ('01-" + DtpMnth.Value.ToString("MMM-yy") + "' between period_frm and period_to) and sub_id not in (select sub_id from mas_sub_issues where issue_month='01-" + DtpMnth.Value.ToString("MMM-yy") + "')");
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    int     issue = 1;
                    DataSet ds1   = db.GetTableData("select action_type, max(current_sub_no) issue from mas_sub_issues where sub_id=" + dr["sub_id"].ToString() + " group by action_type");
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            issue = Convert.ToInt32(dr1["issue"].ToString()) + 1;
                        }
                    }
                    double   id  = db.GetNewID("mas_sub_issues", "issue_id");
                    string[] res = db.ExecuteQueries("Insert into mas_sub_issues values (" + id + "," + dr["sub_id"].ToString() + "," + dr["pay_id"].ToString() + ",'01-" + DtpMnth.Value.ToString("MMM-yy") + "','" + DtpDspchDt.Value.ToString("dd-MMM-yy") + "'," + issue + "," + dr["Quantity"].ToString() + ",null,null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                    if (res[0].ToString() != "0")
                    {
                        MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    gensubs++;
                    TxtSub.Text = gensubs.ToString();
                    Application.DoEvents();
                }

                MessageBox.Show("Successfully Generated", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtType.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Subscription Type", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TxtIssues.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid No. of Subscriptions", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DataSet ds;

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_sub_type where sub_type_id<>" + LblPK.Text.Trim() + " and sub_type_name='" + TxtType.Text.Trim() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("This Subscription Type already exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                ds = db.GetTableData("select * from mas_sub_type where sub_type_name='" + TxtType.Text.Trim() + "'");
                if (ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("This Subscription Type already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_sub_type set sub_type_name='" + TxtType.Text.Trim() + "', issues=" + TxtIssues.Text.Trim() + ", Remarks='" + TxtRemarks.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_type_id=" + LblPK.Text.Trim()).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Insert into mas_sub_type values (" + db.GetNewID("mas_sub_type", "sub_type_id") + ",'" + TxtType.Text.Trim() + "'," + TxtIssues.Text.Trim() + ",'" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            }

            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion / Updation Failure..", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtIssues.Text  = "";
                TxtRemarks.Text = "";
                TxtType.Text    = "";
                LblPK.Text      = "";
                TxtType.Focus();
            }
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtUserName.Text.Trim().Length < 4)
            {
                MessageBox.Show("Invalid User Name. User Name should be minimum 4 Characters", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUserName.Focus();
                return;
            }

            if (TxtPwd.Text.Trim().Length < 4)
            {
                MessageBox.Show("Invalid Password. Password should be minimum 4 characters", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtPwd.Focus();
                return;
            }

            DataSet ds;

            if (LblPK.Text.Trim().Length <= 0)
            {
                ds = db.GetTableData("select * from mas_adm_user where user_name='" + TxtUserName.Text.Trim() + "'");
            }
            else
            {
                ds = db.GetTableData("select * from mas_adm_user where user_name='" + TxtUserName.Text.Trim() + "' and user_id<>" + LblPK.Text);
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("This User Name already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtUserName.Focus();
                return;
            }

            string[] res;
            if (LblPK.Text.Trim().Length <= 0)
            {
                res = db.ExecuteQueries("Insert into mas_adm_user values (" + db.GetNewID("mas_adm_user", "user_id") + ",'" + TxtUserName.Text.Trim() + "','" + TxtPwd.Text.Trim() + "','" + CmbStatus.Text.Substring(0, 1) + "',null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Update mas_adm_user set user_name='" + TxtUserName.Text.Trim() + "', Pwd='" + TxtPwd.Text.Trim() + "', status='" + CmbStatus.Text.Substring(0, 1) + "', modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where user_id=" + LblPK.Text.Trim()).Split(',');
            }

            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Failure...\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtPwd.Text      = "";
                TxtUserName.Text = "";
                TxtUserName.Focus();
                LblPK.Text = "";
            }
        }
Exemplo n.º 4
0
 private void FrmExecutive_Load(object sender, EventArgs e)
 {
     cs.FrmStyle(this);
     TxtID.Text = db.GetNewID("mas_executive", "executive_id").ToString();
     if (LblPK.Text.Trim().Length > 0)
     {
         TxtID.Text = LblPK.Text;
         DataSet ds = db.GetTableData("select * from mas_executive where executive_id=" + LblPK.Text);
         if (ds.Tables[0].Rows.Count > 0)
         {
             foreach (DataRow dr in ds.Tables[0].Rows)
             {
                 TxtName.Text = dr["executive_name"].ToString();
                 TxtRemarks.Text = dr["Remarks"].ToString();
             }
         }
     }
 }
Exemplo n.º 5
0
        private void FrmClient_Load(object sender, EventArgs e)
        {
            cs.FrmStyle(this);
            db.TxtAutoFill(TxtName, "MAS_CLIENT", "CLIENT_NAME");
            TxtCode.Text = db.GetNewID("Mas_CLIENT", "CLIENT_Code").ToString();

            DataSet ds = db.GetTableData("Select state_code,state_name||'('||state_code||')' state_name, action_type from mas_gst_state");

            CmbState.DataSource    = ds.Tables[0];
            CmbState.DisplayMember = "state_name";
            CmbState.ValueMember   = "state_code";

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_CLIENT where CLIENT_Code=" + LblPK.Text);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        TxtCode.Text = dr["CLIENT_Code"].ToString();
                        TxtName.Text = dr["CLIENT_Name"].ToString();
                        TxtComm.Text = dr["CLIENT_Commission"].ToString();
                        if (dr["active_flag"].ToString() == "Y")
                        {
                            ChkActive.Checked = true;
                        }
                        else
                        {
                            ChkActive.Checked = false;
                        }
                        DataSet ds1 = db.GetTableData("Select * from mas_gst_state where state_code=" + dr["state_code"].ToString());
                        foreach (DataRow dr1 in ds1.Tables[0].Rows)
                        {
                            CmbState.Text = dr1["State_name"].ToString() + "(" + dr1["State_Code"].ToString() + ")";
                        }
                        TxtGSTNo.Text   = dr["Gst_No"].ToString();
                        TxtPANNo.Text   = dr["PAN_No"].ToString();
                        TxtRemarks.Text = dr["Remarks"].ToString();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtName.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Distributor Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtAddress.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Distributor Address", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataSet ds;

            if (LblPK.Text.Trim().Length > 0)
            {
                ds = db.GetTableData("select * from mas_distributor where distributor_name='" + TxtName.Text.Trim() + "' and region_id=" + db.ExtractCode(CmbRegion.Text) + " and distributor_code<>" + LblPK.Text);
            }
            else
            {
                ds = db.GetTableData("select * from mas_distributor where distributor_name='" + TxtName.Text.Trim() + "' AND region_ID=" + db.ExtractCode(CmbRegion.Text));
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("This Distributor Name already Exists", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_distributor set distributor_name='" + TxtName.Text.Trim() + "', region_id=" + db.ExtractCode(CmbRegion.Text) + ", distributor_address='" + TxtAddress.Text.Trim() + "', remarks='" + TxtRemarks.Text.Trim() + "', modified_by='" + GlobalClass.UserName + "', MODIFIED_DATE=SYSDATE WHERE DISTRIBUTOR_CODE=" + LblPK.Text.Trim()).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("INSERT INTO MAS_DISTRIBUTOR VALUES (" + db.GetNewID("mas_distributor", "distributor_code") + ",'" + TxtName.Text.Trim() + "'," + db.ExtractCode(CmbRegion.Text) + ",'" + TxtAddress.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(',');
            }
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Updation Failure..", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                TxtAddress.Text = "";
                TxtName.Text    = "";
                TxtRemarks.Text = "";
                LblPK.Text      = "";
                TxtName.Focus();
            }
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (CmbRegion.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbRegion.Text)) <= 0)
            {
                MessageBox.Show("Invalid Region Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbRegion.Focus();
                return;
            }

            if (CmbParty.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbParty.Text)) <= 0)
            {
                MessageBox.Show("Invalid Party Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbParty.Focus();
                return;
            }

            if (CmbPayMode.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbPayMode.Text)) <= 0)
            {
                MessageBox.Show("Invalid Payment Mode", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbPayMode.Focus();
                return;
            }

            if (CmbBank.Items.Count <= 0 || Convert.ToInt32(db.ExtractCode(CmbBank.Text)) <= 0)
            {
                MessageBox.Show("Invalid Bank Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbBank.Focus();
                return;
            }

            if (TxtAmount.Text.Length <= 0)
            {
                MessageBox.Show("Invalid Receipt Amount", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAmount.Focus();
                return;
            }

            if (Convert.ToDouble(TxtAmount.Text) <= 0)
            {
                MessageBox.Show("Invalid Receipt Amount", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAmount.Focus();
                return;
            }

            string rcptno = db.GetAccCode("RC", "mas_acc_receipt", "Receipt_code", DtpRcptDt.Value);

            string[] res = db.ExecuteQueries("Insert into mas_acc_receipt values ('" + rcptno + "','" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','" + db.GetFinYr(DtpRcptDt.Value) + "'," + db.ExtractCode(CmbPartyType.Text) + "," + db.ExtractCode(CmbRegion.Text) + "," + db.ExtractCode(CmbParty.Text) + "," + TxtAmount.Text.Trim() + "," + db.ExtractCode(CmbPayMode.Text) + ",'" + TxtRefNo.Text.Trim() + "','" + DtpRefDt.Value.ToString("dd-MMM-yyyy") + "'," + db.ExtractCode(CmbBank.Text) + ",'" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            res = db.ExecuteQueries("Insert into mas_acc_reconcillation values (" + db.GetNewID("mas_acc_reconcillation", "recon_code") + ",'" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','" + db.GetFinYr(DtpRcptDt.Value) + "'," + db.ExtractCode(CmbPartyType.Text) + "," + db.ExtractCode(CmbParty.Text) + "," + db.ExtractCode(CmbRegion.Text) + ",'" + rcptno + "','" + DtpRcptDt.Value.ToString("dd-MMM-yyyy") + "','R'," + TxtAmount.Text.Trim() + ",null,null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                db.ExecuteQueries("Delete from mas_acc_receipt where receipt_code='" + rcptno + "'");
                return;
            }

            MessageBox.Show("Successfully Saved with Receipt No. " + rcptno, "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            TxtAmount.Text   = "";
            TxtRcptCode.Text = db.GetAccCode("RC", "mas_acc_receipt", "Receipt_code", DtpRcptDt.Value);
            TxtRefNo.Text    = "";
            TxtRemarks.Text  = "";
        }
Exemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (TxtAddress.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Address", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtCity.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid City Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtStateCode.Text.Trim().Length <= 0)
            {
                MessageBox.Show("State Code Mandatory", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (TxtPANNo.Text.Trim().Length > 0)
            {
                if (TxtPANNo.Text.Trim().Length != 10)
                {
                    MessageBox.Show("Invalid PAN Number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (TxtGSTNo.Text.Trim().Length > 0)
                {
                    if (TxtPANNo.Text.Trim() != TxtGSTNo.Text.Trim().Substring(2, 10))
                    {
                        MessageBox.Show("Invalid PAN Number or GST Number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            if (TxtGSTNo.Text.Trim().Length > 0)
            {
                if (TxtGSTNo.Text.Trim().Length != 15)
                {
                    MessageBox.Show("Invalid GST number", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (TxtGSTNo.Text.Trim().Substring(0, 2) != TxtStateCode.Text.Trim())
                {
                    MessageBox.Show("Invalid GST Number or State Code", "MCube", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            string ptype = "";

            if (CmbPartyType.Text == "Agency")
            {
                ptype = "AG";
            }
            else
            {
                ptype = "CL";
            }
            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_address_book set address='" + TxtAddress.Text.Trim() + "', Town_City='" + TxtCity.Text.Trim() + "', PINCOde='" + TxtPIN.Text.Trim() + "',Telephone='" + TxtTelPh.Text.Trim() + "',Fax='" + TxtFax.Text.Trim() + "',Mobile='" + TxtMobile.Text.Trim() + "',Email_ID='" + TxtMail.Text.Trim() + "', State_Code='" + TxtStateCode.Text.Trim() + "',GST_No='" + TxtGSTNo.Text.Trim() + "', PAN_No='" + TxtPANNo.Text.Trim() + "', Remarks='" + TxtRemarks.Text.Trim() + "', Modified_by='" + GlobalClass.UserName + "', Modified_date=sysdate where address_id=" + LblPK.Text).Split(',');
            }
            else
            {
                res = db.ExecuteQueries("Insert into mas_address_book values (" + db.GetNewID("Mas_Address_book", "Address_id") + "," + db.ExtractCode(CmbRegion.Text) + ",'" + ptype + "'," + db.ExtractCode(CmbPartyName.Text) + ",'" + TxtAddress.Text.Trim() + "','" + TxtCity.Text.Trim() + "','" + TxtPIN.Text + "','" + TxtTelPh.Text.Trim() + "','" + TxtFax.Text.Trim() + "','" + TxtMobile.Text.Trim() + "','" + TxtMail.Text.Trim() + "','" + TxtStateCode.Text.Trim() + "','" + TxtGSTNo.Text.Trim() + "','" + TxtPANNo.Text.Trim() + "','" + TxtRemarks.Text.Trim() + "','" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(',');
            }
            if (res[0].ToString() != "0")
            {
                MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LblPK.Text        = "";
                TxtAddress.Text   = "";
                TxtCity.Text      = "";
                TxtPIN.Text       = "";
                TxtTelPh.Text     = "";
                TxtFax.Text       = "";
                TxtMobile.Text    = "";
                TxtMail.Text      = "";
                TxtRemarks.Text   = "";
                TxtStateCode.Text = "";
                TxtGSTNo.Text     = "";
                TxtPANNo.Text     = "";
            }
        }
Exemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            string IsCombo = "N";

            if (TxtBrand.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Brand Name", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtCaption.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid Caption Details", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (TxtCaption.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Invalid AD Size", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Convert.ToInt32(TxtNoofAds.Text) <= 0)
            {
                MessageBox.Show("Please Enter No. of Ads", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (checkBox1.Checked)
            {
                if (TxtActualRate.Text.Trim().Length <= 0)
                {
                    MessageBox.Show("Please enter Actual Rate", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (Convert.ToDouble(TxtActualRate.Text) <= 0)
                {
                    MessageBox.Show("Invalid Actual Rate", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                IsCombo = "Y";
            }

            string[] res;

            if (IsNewRo)
            {
                TxtROCode.Text = GetROCode();
                res            = db.ExecuteQueries("Insert into hdr_ro values ('" + TxtROCode.Text.Trim() + "','" + DtpRoDt.Value.ToString("dd-MMM-yy") + "'," + db.ExtractCode(CmbAgency.Text) + "," + db.ExtractCode(CmbClient.Text) + "," + db.ExtractCode(CmbExecutive.Text) + "," + db.ExtractCode(CmbRegion.Text) + "," + db.ExtractCode(CmbADCategory.Text) + ",null,'" + TxtClientRefNo.Text.Trim() + "','" + DtpRefDt.Value.ToString("dd-MMM-yy") + "','" + CmbBillingMode.Text.Trim() + "',null,'" + IsCombo + "',null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Insertion Failure in RO Header", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            DateTime dtfrm = Convert.ToDateTime("01-" + DtpMnthFrm.Value.ToString("MMM-yy"));
            DateTime dtto  = Convert.ToDateTime("01-" + DtpMnthTo.Value.ToString("MMM-yy"));
            DataSet  ds    = db.GetTableData("select max(sr_no) srno, decode(action_type,'U','I','D','I',action_type) Action_type from dtl_ro where ro_header_code='" + TxtROCode.Text.ToString() + "' group by decode(action_type,'U','I','D','I',action_type)");
            int      i     = 0;

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    i = Convert.ToInt32(dr["srno"].ToString());
                }
            }

            for (DateTime dt = dtfrm; dt <= dtto; dt = dt.AddMonths(1))
            {
                for (int r = 1; r <= Convert.ToInt32(TxtNoofAds.Text); r++)
                {
                    i++;
                    res = db.ExecuteQueries("Insert into dtl_ro values (" + db.GetNewID("dtl_ro", "ro_detail_code") + "," + db.ExtractCode(CmbSpotCategory.Text) + ",'" + dt.ToString("dd-MMM-yy") + "'," + TxtNoofAds.Text.Trim() + "," + TxtReateCard.Text.Trim() + "," + TxtActualRate.Text.Trim() + ",'" + TxtBrand.Text.Trim() + "','" + TxtCaption.Text.Trim() + "','" + TxtSize.Text.Trim() + "','B','" + TxtROCode.Text.Trim() + "'," + i.ToString() + ",null,null,null,'" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                    if (res[0].ToString() != "0")
                    {
                        MessageBox.Show("Insertioin Failure in RO Detail Code", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        db.ExecuteQueries("Delete from hdr_ro where ro_header_code='" + TxtROCode.Text + "'");
                        db.ExecuteQueries("Delete from dtl_ro where ro_header_code='" + TxtROCode.Text + "'");
                        TxtROCode.Text = GetROCode();
                        return;
                    }
                }
            }
            if (MessageBox.Show("Successfully Saved. Do you want to Continuee with same RO..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                groupBox1.Enabled  = false;
                IsNewRo            = false;
                TxtReateCard.Text  = "";
                TxtActualRate.Text = "";
                TxtBrand.Text      = "";
                TxtCaption.Text    = "";
                TxtSize.Text       = "";
                TxtNoofAds.Text    = "";
                DataSet ds1 = db.GetTableData("select * from dtl_ro where ro_header_code='" + TxtROCode.Text.Trim() + "' order by sr_no");
                dataGridView1.DataSource = ds1.Tables[0];
            }
            else
            {
                TxtROCode.Text           = GetROCode();
                IsNewRo                  = true;
                groupBox1.Enabled        = true;
                TxtReateCard.Text        = "";
                TxtActualRate.Text       = "";
                TxtBrand.Text            = "";
                TxtCaption.Text          = "";
                TxtSize.Text             = "";
                TxtNoofAds.Text          = "";
                dataGridView1.DataSource = null;
                dataGridView1.Rows.Clear();
            }
        }
Exemplo n.º 10
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you Sure, Do you want to Save..?", "HD Magazine", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    string[] res;
                    if (dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString().Trim().Length > 0 || dataGridView1.Rows[i].Cells["Remarks"].Value.ToString().Trim().Length > 0)
                    {
                        DataSet ds = db.GetTableData("Select * from mas_capsulling where ro_detail_code=" + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString());
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            res = db.ExecuteQueries("Update mas_capsulling set published_page='" + dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString() + "',Remarks='" + dataGridView1.Rows[i].Cells["Remarks"].Value.ToString() + "', Modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where ro_detail_code=" + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString()).Split(',');
                        }
                        else
                        {
                            res = db.ExecuteQueries("Insert into mas_capsulling values (" + db.GetNewID("Mas_Capsulling", "Tx_Code") + ",'01-" + DtpMnth.Value.ToString("MMM-yy") + "','" + dataGridView1.Rows[i].Cells["RO_Header_Code"].Value.ToString() + "'," + dataGridView1.Rows[i].Cells["RO_Detail_Code"].Value.ToString() + ",'" + dataGridView1.Rows[i].Cells["Page_NO"].Value.ToString() + "',null,'" + dataGridView1.Rows[i].Cells["Remarks"].Value.ToString() + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                        }

                        if (res[0].ToString() != "0")
                        {
                            MessageBox.Show("Insertion Failure..", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
                    }
                }
                MessageBox.Show("Successfully Saved", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemplo n.º 11
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (TxtVNo.Text.Trim().Length <= 0)
            {
                MessageBox.Show("Enter Voucher Number", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtVNo.Focus();
                return;
            }
            if (TxtName.Text.Trim().Length <= 2)
            {
                MessageBox.Show("Invalid Subcriber Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtName.Focus();
                return;
            }

            if (TxtAdd.Text.Trim().Length <= 5)
            {
                MessageBox.Show("Invalid Subscriber Address", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtAdd.Focus();
                return;
            }

            if (TxtPIN.Text.Trim().Length > 0)
            {
                if (TxtPIN.Text.Trim().Length != 6)
                {
                    MessageBox.Show("Invalid PIN Code", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    TxtPIN.Focus();
                    return;
                }
            }

            if (Convert.ToInt32(db.ExtractCode(CmbExecutive.Text)) <= 0)
            {
                MessageBox.Show("Invalid Executive Name", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CmbExecutive.Focus();
                return;
            }

            if (Convert.ToInt16(TxtQty.Text) <= 0)
            {
                MessageBox.Show("Invalid Quantity", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                TxtQty.Focus();
                return;
            }

            DataSet ds;

            ds = db.GetTableData("Select * from mas_sub_pay_details where voucher_no='" + TxtOldVNo.Text.Trim() + "' and '01-" + DtpMnthFrm.Value.ToString("MMM-yy") + "' between period_frm and period_to");
            if (ds.Tables[0].Rows.Count > 0)
            {
                MessageBox.Show("Invalid Previous Subscription Voucher Number", "HD Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            //if (TxtPhone.Text.Trim().Length < 10)
            //{
            //    MessageBox.Show("Invalid Mobile Number", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    TxtAdd.Focus();
            //    return;
            //}

            int issues = 0;

            ds = db.GetTableData("Select * from MAS_SUB_TYPE where sub_type_id=" + db.ExtractCode(CmbSubType.Text));
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    issues = Convert.ToInt32(dr["issues"].ToString());
                }
            }
            string[] res;
            if (LblPK.Text.Trim().Length > 0)
            {
                res = db.ExecuteQueries("Update mas_subscriptions set state_id=" + db.ExtractCode(CmbState.Text) + ", district_id=" + db.ExtractCode(CmbDistrict.Text) + ", region_id=" + db.ExtractCode(CmbRegion.Text) + ",  sub_name='" + TxtName.Text + "',address='" + TxtAdd.Text + "',city_name='" + TxtCity.Text + "',pin_code='" + TxtPIN.Text + "',email_id='" + TxtEMail.Text + "',contact_no='" + TxtPhone.Text + "',remarks='" + TxtRemarks.Text + "',modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_id=" + LblPK.Text).Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Updation Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                res = db.ExecuteQueries("Update MAS_SUB_PAY_DETAILS set executive_id=" + db.ExtractCode(CmbExecutive.Text) + ", voucher_no='" + TxtVNo.Text.Trim() + "', prev_voucher_no='" + TxtOldVNo.Text.Trim() + "', period_frm='01-" + DtpMnthFrm.Value.ToString("MMM-yyyy") + "', period_to='01-" + DtpMnthTo.Value.ToString("MMM-yyyy") + "', sub_type=" + db.ExtractCode(CmbSubType.Text) + ", Amount=" + TxtAmt.Text + ", sponsor_id=" + db.ExtractCode(CmbSponsor.Text) + ", Quantity=" + TxtQty.Text + ", Modified_by='" + GlobalClass.UserName + "', modified_date=sysdate where sub_id=" + LblPK.Text.Trim() + " and voucher_no='" + TxtVNo.Text.Trim() + "'").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Updation Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                int sid = db.GetNewID("mas_subscriptions", "sub_id");
                res = db.ExecuteQueries("Insert into mas_subscriptions values (" + sid.ToString() + "," + db.ExtractCode(CmbState.Text) + "," + db.ExtractCode(CmbDistrict.Text) + "," + db.ExtractCode(CmbRegion.Text) + ",'" + TxtName.Text + "','" + TxtAdd.Text + "','" + TxtCity.Text + "','" + TxtPIN.Text + "','" + TxtEMail.Text + "','" + TxtPhone.Text + "','" + TxtRemarks.Text + "','" + GlobalClass.UserName + "',sysdate, null, null, 'I')").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                res = db.ExecuteQueries("Insert into mas_sub_pay_details values (" + db.GetNewID("mas_sub_pay_details", "pay_id") + "," + sid.ToString() + "," + db.ExtractCode(CmbExecutive.Text) + ", '" + TxtVNo.Text.Trim() + "','" + TxtOldVNo.Text.Trim() + "','01-" + DtpMnthFrm.Value.ToString("MMM-yyyy") + "','01-" + DtpMnthTo.Value.ToString("MMM-yyyy") + "'," + db.ExtractCode(CmbSubType.Text) + "," + TxtAmt.Text + "," + db.ExtractCode(CmbSponsor.Text) + "," + TxtQty.Text + ",null,'" + GlobalClass.UserName + "', sysdate, null, null, 'I')").Split(',');
                if (res[0].ToString() != "0")
                {
                    MessageBox.Show("Insertion Failure..\n" + res[1].ToString(), "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    db.ExecuteQueries("Delete from mas_subscriptions where sub_id=" + sid.ToString());
                    return;
                }
            }

            MessageBox.Show("Successfully Saved", "Hindudharmam Magazine", MessageBoxButtons.OK, MessageBoxIcon.Information);
            TxtName.Text    = "";
            TxtAdd.Text     = "";
            TxtCity.Text    = "";
            TxtEMail.Text   = "";
            TxtPhone.Text   = "";
            TxtPIN.Text     = "";
            TxtRemarks.Text = "";
            TxtVNo.Text     = vouchernumber();
            TxtVNo.Focus();
            TxtOldVNo.Text           = "";
            LblPK.Text               = "";
            DtpMnthFrm.Enabled       = true;
            CmbSponsor.SelectedIndex = 0;
            DtpMnthFrm.MinDate       = Convert.ToDateTime("01-" + DateTime.Now.ToString("MMM-yyyy"));
            DtpMnthFrm.Value         = Convert.ToDateTime("01-" + DateTime.Now.ToString("MMM-yyyy"));
            TxtQty.Text              = "1";
            db.TxtAutoFill(TxtCity, "mas_subscriptions", "city_name");
            db.TxtAutoFill(TxtPIN, "mas_subscriptions", "PIN_CODE");
            db.TxtAutoFill(TxtOldVNo, "mas_sub_pay_details", "voucher_no");
        }