コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                {
                    sqlcon.Open();
                    var sqlcom      = sqlcon.CreateCommand();
                    var transaction = sqlcon.BeginTransaction("SaveTransaction");
                    sqlcom.Connection  = sqlcon;
                    sqlcom.Transaction = transaction;
                    sqlcom.CommandType = CommandType.Text;
                    try
                    {
                        if (s1 == "&Add")
                        {
                            sqlcom.CommandText = " SET TRANSACTION ISOLATION LEVEL SERIALIZABLE  Begin Transaction "
                                                 + " Insert into RetailerMst"
                                                 + " (RCode,RName,RAddress1,RAddress2,RAddress3,RContactNo,REmailId,SupplierCode)"
                                                 + " values((SELECT RIGHT('000000'+ CAST( ISNULL( max(Cast(RCode as int)),0)+1 AS VARCHAR(6)),6)from RetailerMst),@RName,@RAddress1,@RAddress2,@RAddress3,@RContactNo,@REmailId,@SupplierCode )"
                                                 + " Commit ";
                        }
                        if (s1 == "Edit")
                        {
                            sqlcom.CommandText = " UPDATE RetailerMst SET "
                                                 + " RCode=@RCode,RName=@RName ,RAddress1=@RAddress1,RAddress2=@RAddress2,RAddress3=@RAddress3,RContactNo=@RContactNo,REmailId=@REmailId,SupplierCode=@SupplierCode"
                                                 + " Where RCode=@RCode";
                        }
                        sqlcom.Parameters.AddWithValue("@RCode", txtSCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@RName", txtSName.Text.Trim());

                        sqlcom.Parameters.AddWithValue("@RAddress1", txtAddress1.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@RAddress2", txtAddress2.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@RAddress3", txtAddress3.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@RContactNo", txtTel.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@REmailId", txtEmail.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@SupplierCode", txtDealerCode.Text.Trim());
                        sqlcom.ExecuteNonQuery();
                        transaction.Commit();
                        sqlcon.Close();
                        ProjectFunctions.SpeakError("Data Saved Successfully");
                        this.Close();
                    }
                    catch (Exception ex)
                    {
                        ProjectFunctions.SpeakError("Something Wrong. \n I am going to Roll Back." + ex.Message);
                        try
                        {
                            transaction.Rollback();
                        }
                        catch (Exception ex2)
                        {
                            ProjectFunctions.SpeakError("Something Wrong. \n Roll Back Failed." + ex2.Message);
                        }
                    }
                }
            }
        }
コード例 #2
0
        private void SetMyControls()
        {
            //var Query4Controls = string.Empty;
            //panelControl1.Location = new Point(ClientSize.Width / 2 - panelControl1.Size.Width / 2, ClientSize.Height / 2 - panelControl1.Size.Height / 2);
            ProjectFunctions.XtraFormVisualize(this);
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
            //ProjectFunctions.GroupCtrlVisualize(panelControl1);


            //ProjectFunctions.DatePickerVisualize(panelControl1);
            //ProjectFunctions.TextBoxVisualize(panelControl1);
            //ProjectFunctions.ButtonVisualize(panelControl1);
            //Query4Controls = String.Format("SELECT     ProgAdd_F, ProgUpd_F, ProgDel_F, ProgRep_p, ProgRep_p,ProgSpl_U FROM         UserProgAccess WHERE     (ProgActive is Null or progActive= 'Y') AND (ProgCode = N'" + GlobalVariables.ProgCode + "') AND (UserName = N'{0}'); ", GlobalVariables.CurrentUser);

            MainFormButtons.Roles(GlobalVariables.ProgCode, GlobalVariables.CurrentUser,
                                  btnAdd, btnEdit, btnDelete, btnPrint);
            //using (var Tempds = ProjectFunctions.GetDataSet(Query4Controls))
            //{
            //    if (Tempds != null)
            //    {
            //        if (Tempds.Tables[0].Rows.Count > 0)
            //        {
            //            if (Tempds.Tables[0].Rows[0]["ProgAdd_F"].ToString() == "-1")
            //            {
            //                btnAdd.Enabled = true;
            //            }
            //            else
            //            {
            //                btnAdd.Enabled = false;
            //            }
            //            if (Tempds.Tables[0].Rows[0]["ProgUpd_F"].ToString() == "-1")
            //            {
            //                btnEdit.Enabled = true;
            //            }
            //            else
            //            {
            //                btnEdit.Enabled = false;
            //            }
            //            if (Tempds.Tables[0].Rows[0]["ProgDel_F"].ToString() == "-1")
            //            {
            //                btnDelete.Enabled = true;
            //            }
            //            else
            //            {
            //                btnDelete.Enabled = false;
            //            }
            //            if (Tempds.Tables[0].Rows[0]["ProgRep_p"].ToString() == "-1")
            //            {
            //                btnPrint.Enabled = true;
            //            }
            //            else
            //            {
            //                btnPrint.Enabled = false;
            //            }
            //        }
            //    }
            //}
        }
コード例 #3
0
 private void refreshStageCombo()
 {
     ProjectFunctions.SetFullStageList();
     StageCombo.ItemsSource = ProjectFunctions.FullStageList;
     if (!stagesLoaded)
     {
         stagesLoaded = true;
     }
 }
コード例 #4
0
        private void SetMyControls()
        {
            ProjectFunctions.TextBoxVisualize(this);
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);

            txtGauge.Properties.MaxLength = 6;

            txtMachineCode.Enabled = false;
        }
コード例 #5
0
 private void displaySelectedManager(int currentManagerID)
 {
     try
     {
         StaffProxy selectedManager = ProjectFunctions.GetPMInOptionsList(currentManagerID);
         ManagerCombo.SelectedIndex = ProjectFunctions.PMOptionsList.IndexOf(selectedManager);
     }
     catch (Exception generalException) { MessageFunctions.Error("Error selecting current Project Manager", generalException); }
 }
コード例 #6
0
 private void SetMyControls()
 {
     ProjectFunctions.TextBoxVisualize(this);
     ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
     txtFabricContent.Properties.MaxLength = 100;
     txtFabricLotNo.Properties.MaxLength   = 100;
     txtFabricCode.Enabled = true;
     txtQty.Enabled        = true;
 }
コード例 #7
0
        private bool ValidateData()
        {
            if (txtRouteCode.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Route Code");
                txtRouteCode.Focus();
                return(false);
            }
            if (txtRouteName.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Route Description");
                txtRouteName.Focus();
                return(false);
            }
            if (txtLcTag.Text.Trim().Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Route LCTag");
                txtLcTag.Focus();
                return(false);
            }
            if (txtCoverage.Text.Trim().Length == 0)
            {
                txtCoverage.Text = "0";
            }
            //if (txtStatusTag.Text.Trim() == "Y")
            //{

            //}
            //else
            //{
            //    if (txtStatusTag.Text.Trim() == "N")
            //    {

            //    }
            //    else
            //    {
            //        ProjectFunctions.SpeakError("Valid Values Are Y/N");
            //        txtStatusTag.Focus();
            //    }
            //}
            if (txtLcTag.Text.Trim() == "L")
            {
            }
            else
            {
                if (txtLcTag.Text.Trim() == "C")
                {
                }
                else
                {
                    ProjectFunctions.SpeakError("Valid Values Are L-Local/C-Central");
                    txtLcTag.Focus();
                    return(false);
                }
            }
            return(true);
        }
コード例 #8
0
        private void CommitButton_Click(object sender, RoutedEventArgs e)
        {
            bool success = ProjectFunctions.SaveActions();

            if (success)
            {
                resetChanges();
            }
        }
コード例 #9
0
        private void SetMyControls()
        {
            ProjectFunctions.TextBoxVisualize(this);
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);

            txtBrandName.Properties.MaxLength = 100;

            txtBrandCode.Enabled = false;
        }
コード例 #10
0
 private void displaySelectedStage()
 {
     try
     {
         ProjectStages selectedStage = ProjectFunctions.GetStageByID(thisProjectProxy.StageID); // Gets it from FullStageList, so it is picked up
         StageCombo.SelectedIndex = ProjectFunctions.FullStageList.IndexOf(selectedStage);
     }
     catch (Exception generalException) { MessageFunctions.Error("Error selecting current project stage", generalException); }
 }
コード例 #11
0
        private void SetMyControls()
        {
            ProjectFunctions.ToolStripVisualize(Menu_ToolStrip);
            ProjectFunctions.TextBoxVisualize(this);
            ProjectFunctions.ButtonVisualize(this);

            txtSerialNo.Enabled   = false;
            DtfeedingDate.Enabled = false;
        }
コード例 #12
0
        private void RemoveButton_Click(object sender, RoutedEventArgs e)
        {
            bool success = ProjectFunctions.RemoveTeamEntry(selectedTeamRecord);

            if (success)
            {
                refreshTeamDataGrid();
            }
        }
コード例 #13
0
 private void refreshEditRoleCombo()
 {
     try
     {
         ProjectFunctions.SetFullRolesList();
         EditRoleCombo.ItemsSource = ProjectFunctions.FullRolesList;
     }
     catch (Exception generalException) { MessageFunctions.Error("Error populating project roles drop-down selection list", generalException); }
 }
コード例 #14
0
        private bool ValidateDataForSaving()
        {
            if (txtAccountCode.Text.Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Account Code");
                txtAccountCode.Focus();
                return(false);
            }
            if (txtAccountName.Text.Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid Account Name");
                txtAccountCode.Focus();
                return(false);
            }
            if (txtVoucherTypeCode.Text.Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid VuType");
                txtVoucherTypeCode.Focus();
                return(false);
            }
            if (txtVoucherTypeDesc.Text.Length == 0)
            {
                ProjectFunctions.SpeakError("Invalid VuType");
                txtVoucherTypeCode.Focus();
                return(false);
            }
            if (txtShortNarration.Text.Length <= 10)
            {
                ProjectFunctions.SpeakError("Short Narration Should Be At Least 10 Characters");
                txtShortNarration.Focus();
                return(false);
            }
            if (txtLongNarration.Text.Length <= 100)
            {
                ProjectFunctions.SpeakError("Long Narration Should Be At Least 100 Characters");
                txtLongNarration.Focus();
                return(false);
            }
            //decimal DebitAmt = 0;
            //decimal CreditAmt = 0;
            //foreach (DataRow dr in dt.Rows)
            //{
            //    DebitAmt = DebitAmt + Convert.ToDecimal(dr["Debit"]);
            //    CreditAmt = CreditAmt + Convert.ToDecimal(dr["Credit"]);
            //}
            //if (DebitAmt == CreditAmt)
            //{
            //    //  VoucherAmount = DebitAmt;
            //}
            //else
            //{
            //    ProjectFunctions.SpeakError("Debit Amount Should Be Equal To Credit Amount");
            //    return false;
            //}

            return(true);
        }
コード例 #15
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (TextAuthenticate.Text == ProjectFunctions.Dirt || TextAuthenticate.Text == ProjectFunctions.UserPwd + "p256")
     {
         DataRow Dr = MaterialRecptGrid.GetFocusedDataRow();
         MMDocNo   = Dr["MmDocNO"].ToString();
         MMDocDate = Convert.ToDateTime(Dr["MmDocDate"]);
         MmDocType = Convert.ToString(Dr["MMDocType"]);
         bool flag = true;
         using (DataSet Ds = ProjectFunctions.GetDataSet(String.Format("[Sp_VoucherPrev4MRIGST] '{1}','{0}','{2}';", MMDocDate.Date.ToString("yyyy-MM-dd"), MMDocNo, MmDocType)))
         {
             if (Ds == null)
             {
                 flag = false; return;
             }
             decimal temp = Convert.ToDecimal(Ds.Tables[3].Rows[0]["MmRDocNetAmt"]) - Convert.ToDecimal(Ds.Tables[2].Compute("Sum(MdPrdNAmt)", "1=1"));
             if (Math.Abs(Math.Round(temp, 2, MidpointRounding.AwayFromZero)) >= 1)
             {
                 flag = false;
                 XtraMessageBox.Show("Voucher is not balanced.", "!Error");
                 return;
             }
         }
         using (DataSet Ds = ProjectFunctions.GetDataSet(String.Format("Select isNull(MmVhrNo,0) as VhrNo From BillToPass where MmDocNO='{0}' and  MMDocDate='{1:yyyy-MM-dd}' and MmDocType='" + MmDocType + "'", MMDocNo, MMDocDate.Date)))
             if ((Ds.Tables[0].Rows[0][0].ToString() == "0" || Ds.Tables[0].Rows[0][0].ToString() == "") && flag)
             {
                 using (var Connection = new SqlConnection(ProjectFunctions.ConnectionString))
                 {
                     SqlCommand cmd = Connection.CreateCommand();
                     cmd.Connection = Connection;
                     Connection.Open();
                     cmd.CommandText = String.Format("[Sp_RMVPostingGST] '{0}','{1:yyyy-MM-dd}','" + MmDocType + "','{2}','{3}','2415'", MMDocNo, MMDocDate, CurrentUser, ProjectFunctions.ClipFYear(FinancialYear));
                     cmd.ExecuteNonQuery();
                 }
             }
             else
             {
                 if (DialogResult.OK == XtraMessageBox.Show("Bill has been Passed. If you press OK.\n Then it will first UNPASS it and then Pass. You can cancel it.\n Please Contact Account Department.", "Error", MessageBoxButtons.OKCancel))
                 {
                     using (var Connection = new SqlConnection(ProjectFunctions.ConnectionString))
                     {
                         SqlCommand cmd = Connection.CreateCommand();
                         cmd.Connection = Connection;
                         Connection.Open();
                         cmd.CommandText = String.Format("[Sp_RMVPostingGST] '{0}','{1:yyyy-MM-dd}','" + MmDocType + "','{2}','{3}','2415'", MMDocNo, MMDocDate, CurrentUser, ProjectFunctions.ClipFYear(FinancialYear));
                         cmd.ExecuteNonQuery();
                     }
                 }
             }
     }
     else
     {
         XtraMessageBox.Show("Dear Sir/Mam,\nYou have no permission to pass");
     }
     fillGrid();
 }
コード例 #16
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                {
                    sqlcon.Open();
                    var sqlcom      = sqlcon.CreateCommand();
                    var transaction = sqlcon.BeginTransaction("SaveTransaction");
                    sqlcom.Connection  = sqlcon;
                    sqlcom.Transaction = transaction;
                    sqlcom.CommandType = CommandType.Text;
                    try
                    {
                        if (S1 == "&Add")
                        {
                            sqlcom.CommandText = " SET TRANSACTION ISOLATION LEVEL SERIALIZABLE  Begin Transaction "
                                                 + " Insert into MachineMst"
                                                 + " (MachineCode,MachineTypeCode,MachineBrandCode,MachineGauge)"
                                                 + " values((SELECT RIGHT('0000'+ CAST( ISNULL( max(Cast(MachineCode as int)),0)+1 AS VARCHAR(4)),4)from MachineMst),@MachineTypeCode,@MachineBrandCode,@MachineGauge)"
                                                 + " Commit ";
                        }
                        if (S1 == "Edit")
                        {
                            sqlcom.CommandText = " UPDATE MachineMst SET "
                                                 + " MachineTypeCode=@MachineTypeCode,MachineBrandCode=@MachineBrandCode,MachineGauge=@MachineGauge"
                                                 + " Where MachineCode=@MachineCode";
                        }
                        sqlcom.Parameters.AddWithValue("@MachineCode", txtMachineCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@MachineTypeCode", txtTypeCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@MachineBrandCode", txtBrandCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@MachineGauge", txtGauge.Text.Trim());
                        sqlcom.ExecuteNonQuery();
                        transaction.Commit();
                        sqlcon.Close();
                        ProjectFunctions.SpeakError("Data Saved Successfully");



                        Close();
                    }
                    catch (Exception ex)
                    {
                        XtraMessageBox.Show("Something Wrong. \n I am going to Roll Back." + ex.Message, ex.GetType().ToString());
                        try
                        {
                            transaction.Rollback();
                        }
                        catch (Exception ex2)
                        {
                            XtraMessageBox.Show("Something Wrong. \n Roll Back Failed." + ex2.Message, ex2.GetType().ToString());
                        }
                    }
                }
            }
        }
コード例 #17
0
        private void Btn_Add_Click(object sender, EventArgs e)
        {
            var FRMA = new FrmLoanMonthlyData();
            var P    = ProjectFunctions.GetPositionInForm(this);

            FRMA.Location = new Point(P.X + (ClientSize.Width / 2 - FRMA.Size.Width / 2), P.Y + (ClientSize.Height / 2 - FRMA.Size.Height / 2));
            FRMA.Text     = "Loan Monthly Addition";
            FRMA.ShowDialog();
            FillGrid();
        }
コード例 #18
0
 private void NextButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         int newStage = thisProjectProxy.StageNumber + 1;
         updateProjectStage(newStage);
         NextButton.IsEnabled = (!ProjectFunctions.IsLastStage(newStage));
     }
     catch (Exception generalException) { MessageFunctions.Error("Error moving to the next stage", generalException); }
 }
コード例 #19
0
        private void BtnRefreshGridData_Click(object sender, EventArgs e)
        {
            DataSet ds = ProjectFunctions.GetDataSet(string.Format("sp_LoadAdvPenVouchers @Tag='Add',@DlrCode= '{2}',@from='{0}',@to='{1}',@Vuttype='{3}',@Vutno='{4}',@VutDate='{5}' ",
                                                                   DtAdvanceVuDt.DateTime.ToString("yyyy-MM-dd"), DtEndDate.DateTime.ToString("yyyy-MM-dd"), Txt_DealerCode.Text, Txt_AdvVoucherType.Text, Txt_AdvVoucherNo.Text, DtAdvanceVuDt.DateTime.ToString("yyyy-MM-dd")));


            InvoiceGridCtrl.DataSource = ds.Tables[0];

            btnSave.Enabled = false;
        }
コード例 #20
0
 private void displaySelectedClient(int currentClientID)
 {
     // Necessary because the binding won't find the record in the list automatically
     try
     {
         ClientProxy selectedClient = ProjectFunctions.GetClientInOptionsList(currentClientID);
         ClientCombo.SelectedIndex = ProjectFunctions.ClientOptionsList.IndexOf(selectedClient);
     }
     catch (Exception generalException) { MessageFunctions.Error("Error selecting current client", generalException); }
 }
コード例 #21
0
 private void Btn_Pass_Selected_Click(object sender, EventArgs e)
 {
     IndentPassGrd.CloseEditor();
     IndentPassGrd.UpdateCurrentRow();
     foreach (DataRow Dr in (InPassGridCtrl.DataSource as DataTable).Select("Pass=True And IndPassTag='N'"))
     {
         ProjectFunctions.GetDataSet(string.Format(" Update indData set IndPassTag='Y',IndPassDt='{0}',IndDItemQtyPass='******',IndDPassUser='******',IndDPassedDt=GetDate() where IndID={2};", DtIndentPass.DateTime.Date.ToString("yyyy-MM-dd"), Dr["IndDItemQty"], Dr["IndID"], GlobalVariables.CurrentUser));
     }
     FillGrid();
 }
コード例 #22
0
 private bool ValidateData_GridLoad()
 {
     if (txtEmpCode.Text.Trim().Length == 0)
     {
         ProjectFunctions.SpeakError("Enter Employee Code");
         txtEmpCode.Focus();
         return(false);
     }
     return(true);
 }
コード例 #23
0
 private bool ValidateData()
 {
     if (txtGroupDesc.Text.Trim().Length == 0)
     {
         ProjectFunctions.SpeakError("Invalid Address Book Group Desc");
         txtGroupDesc.Focus();
         return(false);
     }
     return(true);
 }
コード例 #24
0
        private bool ValidateData()
        {
            try
            {
                if (txtGroupCode.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Address Group Code");
                    txtGroupCode.Focus();
                    return(false);
                }
                if (txtGroupDesc.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Address Group Desc");
                    txtGroupCode.Focus();
                    return(false);
                }

                if (txtTitle.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Name Title");
                    txtTitle.Focus();
                    return(false);
                }
                if (txtFirstName.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid First Name ");
                    txtFirstName.Focus();
                    return(false);
                }
                if (txtLastName.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Last Name ");
                    txtLastName.Focus();
                    return(false);
                }
                if (txtAddress.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Address ");
                    txtAddress.Focus();
                    return(false);
                }
                if (txtContactNo.Text.Trim().Length == 0)
                {
                    ProjectFunctions.SpeakError("Invalid Contact No ");
                    txtContactNo.Focus();
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                ProjectFunctions.SpeakError(ex.Message);
                return(false);
            }
        }
コード例 #25
0
ファイル: resplitMenu.cs プロジェクト: Shadowth117/sa_tools
        void UpdateProjectFile(SAModel.SAEditorCommon.UI.ProgressDialog progress)
        {
            bool needsUpdate = false;

            if (splitEntries.Count > 0 || splitMDLEntries.Count > 0)
            {
                Templates.ProjectTemplate      projFile       = ProjectFunctions.openProjectFileString(Path.GetFullPath(SAToolsHub.projXML));
                Templates.ProjectInfo          projInfo       = projFile.GameInfo;
                List <Templates.SplitEntry>    projEntries    = projFile.SplitEntries;
                List <Templates.SplitEntryMDL> projMdlEntries = projFile.SplitMDLEntries;


                foreach (Templates.SplitEntry entry in splitEntries)
                {
                    if (!projEntries.Exists(x => x.IniFile == entry.IniFile))
                    {
                        projEntries.Add(entry);
                        needsUpdate = true;
                    }
                }

                if (projMdlEntries.Count > 0)
                {
                    foreach (Templates.SplitEntryMDL entry in splitMDLEntries)
                    {
                        if (!projMdlEntries.Exists(x => x.ModelFile == entry.ModelFile))
                        {
                            projMdlEntries.Add(entry);
                            needsUpdate = true;
                        }
                    }
                }

                if (needsUpdate)
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(Templates.ProjectTemplate));
                    XmlWriter     writer     = XmlWriter.Create(SAToolsHub.projXML, new XmlWriterSettings()
                    {
                        Indent = true
                    });
                    Templates.ProjectTemplate updProjFile = new Templates.ProjectTemplate();


                    updProjFile.GameInfo     = projInfo;
                    updProjFile.SplitEntries = projEntries;
                    if (splitMDLEntries.Count > 0)
                    {
                        updProjFile.SplitMDLEntries = projMdlEntries;
                    }

                    serializer.Serialize(writer, updProjFile);
                    writer.Close();
                }
            }
        }
コード例 #26
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     if (ValidateData())
     {
         using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
         {
             sqlcon.Open();
             var sqlcom      = sqlcon.CreateCommand();
             var transaction = sqlcon.BeginTransaction("SaveTransaction");
             sqlcom.Connection  = sqlcon;
             sqlcom.Transaction = transaction;
             sqlcom.CommandType = CommandType.Text;
             try
             {
                 if (S1 == "&Add")
                 {
                     sqlcom.CommandText = " SET TRANSACTION ISOLATION LEVEL SERIALIZABLE  Begin Transaction "
                                          + " Insert into TdsMst"
                                          + " (TdsCode,TdsDesc,TdsRate,TdsSRate,TdsUS,TdsPostingCode)"
                                          + " values((SELECT RIGHT('0000'+ CAST( ISNULL( max(Cast(TdsCode as int)),0)+1 AS VARCHAR(4)),4)from TdsMst),@TdsDesc,@TdsRate,@TdsSRate,@TdsUS,@TdsPostingCode)"
                                          + " Commit ";
                 }
                 if (S1 == "Edit")
                 {
                     sqlcom.CommandText = " UPDATE TdsMst SET "
                                          + " TdsDesc=@TdsDesc,TdsRate=@TdsRate,TdsSRate=@TdsSRate,TdsUS=@TdsUS,TdsPostingCode=@TdsPostingCode "
                                          + " Where TdsCode=@TdsCode";
                 }
                 sqlcom.Parameters.AddWithValue("@TdsCode", txtTdsCode.Text.Trim());
                 sqlcom.Parameters.AddWithValue("@TdsDesc", txtTdsDesc.Text.Trim());
                 sqlcom.Parameters.AddWithValue("@TdsRate", Convert.ToDecimal(txtRate.Text.Trim()));
                 sqlcom.Parameters.AddWithValue("@TdsSRate", Convert.ToDecimal(txtSurcRate.Text.Trim()));
                 sqlcom.Parameters.AddWithValue("@TdsUS", txtUnderSec.Text.Trim());
                 sqlcom.Parameters.AddWithValue("@TdsPostingCode", txtAcPostingCode.Text.Trim());
                 sqlcom.ExecuteNonQuery();
                 transaction.Commit();
                 sqlcon.Close();
                 ProjectFunctions.SpeakError("Data Saved Successfully");
                 Close();
             }
             catch (Exception ex)
             {
                 ProjectFunctions.SpeakError("Something Wrong. \n I am going to Roll Back." + ex.Message);
                 try
                 {
                     transaction.Rollback();
                 }
                 catch (Exception ex2)
                 {
                     ProjectFunctions.SpeakError("Something Wrong. \n Roll Back Failed." + ex2.Message);
                 }
             }
         }
     }
 }
コード例 #27
0
 private void TxtUnitCode_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         ProjectFunctions.CreatePopUpForTwoBoxes("select  UNITID,UNITNAME from UNITS", " Where UNITID", txtUnitCode, txtUnitName, txtUnitCode, HelpGrid, HelpGridView, e);
     }
     catch (Exception ex)
     {
         ProjectFunctions.SpeakError(ex.Message);
     }
 }
コード例 #28
0
        public FrmAccountsMappingBusy()
        {
            InitializeComponent();
            dt.Columns.Add("AccCodeBusy", typeof(String));
            dt.Columns.Add("AccNameBusy", typeof(String));
            dt.Columns.Add("AccCode", typeof(String));
            dt.Columns.Add("AccName", typeof(String));


            dsPopUps = ProjectFunctions.GetDataSet("Select AccCode,AccName,AccCodeBusy from ActMst  order by AccName");
        }
コード例 #29
0
 private void BtnSave_Click(object sender, EventArgs e)
 {
     Save();
     Prints.CASHMEMO rpt = new Prints.CASHMEMO();
     ProjectFunctions.PrintDocument(lblMemoNo.Text, Convert.ToDateTime(lblMemoDate.Text), "S", rpt);
     Close();
     //Transaction.Cashmemo frm = new Transaction.Cashmemo() { s1 = "&Add", Text = "Cash Memo Addition" };
     //var P = ProjectFunctions.GetPositionInForm(this);
     //frm.Location = new Point(P.X + (ClientSize.Width / 2 - frm.Size.Width / 2), P.Y + (ClientSize.Height / 2 - frm.Size.Height / 2));
     //frm.ShowDialog(Parent);
 }
コード例 #30
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (ValidateData())
            {
                using (var sqlcon = new SqlConnection(ProjectFunctions.GetConnection()))
                {
                    sqlcon.Open();
                    var sqlcom = sqlcon.CreateCommand();
                    sqlcom.Connection  = sqlcon;
                    sqlcom.CommandType = CommandType.Text;
                    try
                    {
                        if (S1 == "&Add")
                        {
                            sqlcom.CommandText = "  Insert into PrdMst"
                                                 + " (PrdCode,PrdAsgnCode,PrdName,PrdUOM,PrdOpStock,PrdActive,PrdGrpCode,PrdSubGrpCode,"
                                                 + " PrdHSNNo,PrdTaxCodePL,PrdTaxCodePC)"
                                                 + " values(@PrdCode,@PrdAsgnCode,@PrdName,@PrdUOM,@PrdOpStock,@PrdActive,@PrdGrpCode,@PrdSubGrpCode,"
                                                 + " @PrdHSNNo,@PrdTaxCodePL,@PrdTaxCodePC)";
                        }
                        if (S1 == "Edit")
                        {
                            sqlcom.CommandText = " UPDATE PrdMst SET "
                                                 + " PrdCode=@PrdCode,PrdAsgnCode=@PrdAsgnCode,PrdName=@PrdName,PrdUOM=@PrdUOM,PrdOpStock=@PrdOpStock,PrdActive=@PrdActive,PrdGrpCode=@PrdGrpCode,PrdSubGrpCode=@PrdSubGrpCode, "
                                                 + " PrdTaxCodePL=@PrdTaxCodePL,PrdTaxCodePC=@PrdTaxCodePC,PrdHSNNo=@PrdHSNNo"
                                                 + " Where PrdCode=@PrdCode";
                        }
                        sqlcom.Parameters.AddWithValue("@PrdCode", Convert.ToDecimal(txtPrdCode.Text.Trim()));
                        sqlcom.Parameters.AddWithValue("@PrdAsgnCode", txtProductAsgnCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdActive", txtstatusTag.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdGrpCode", txtGrpCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdSubGrpCode", txtSGrpCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdName", txtPrdName.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdUOM", txtUMCode.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdOpStock", Convert.ToDecimal(txtOSQty.Text.Trim()));

                        sqlcom.Parameters.AddWithValue("@PrdTaxCodePL", txtTaxCodePC.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdTaxCodePC", txtTaxCodePL.Text.Trim());
                        sqlcom.Parameters.AddWithValue("@PrdHSNNo", txtHSNNo.Text.Trim());



                        sqlcom.ExecuteNonQuery();
                        sqlcon.Close();
                        ProjectFunctions.SpeakError("Data Saved Successfully");
                        Close();
                    }
                    catch (Exception ex)
                    {
                        ProjectFunctions.SpeakError(ex.Message);
                    }
                }
            }
        }