예제 #1
0
        /// <summary> 
        /// Add New Record but first fill the properties. and Id should be 0 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Insert()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myTablesFields = "ProjectId,FolderId,FolderName,FNameSpace,SaveAs,FullPath,FileData,UserId,isActive,CreatedOnUtc," +
                                      "UpdatedOnUtc,ClassType,isGenerated";
                this.myTablesFieldsValues = "@ProjectId,@FolderId,@FolderName,@FNameSpace,@SaveAs,@FullPath,@FileData,@UserId,@isActive,getDate()," +
                                            "getDate(),@ClassType,@isGenerated";
                this.myWhere = " ProjectId = @ProjectId and FolderName=@FolderName and FNameSpace=@FNameSpace and ClassType=@ClassType  ";
                this.mySqlQuery = this.getInsertQuery(this.myTableName, this.myTablesFields, this.myTablesFieldsValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@ProjectId", SqlDbType.Int).Value = this.ProjectId;
                myPara.Add("@FolderId", SqlDbType.Int).Value = this.FolderId;
                myPara.Add("@FolderName", SqlDbType.NVarChar).Value = this.FolderName;
                myPara.Add("@FNameSpace", SqlDbType.NVarChar).Value = this.FNameSpace;
                myPara.Add("@SaveAs", SqlDbType.NVarChar).Value = this.SaveAs;
                myPara.Add("@FullPath", SqlDbType.NVarChar).Value = this.FullPath;
                myPara.Add("@FileData", SqlDbType.NVarChar).Value = this.FileData;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;
                myPara.Add("@ClassType", SqlDbType.NVarChar).Value = this.ClassType;
                myPara.Add("@isGenerated", SqlDbType.Bit).Value = this.isGenerated;

                ReturnIdentity = this.mySqlCommand.ExecuteScalar().ToString();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Created successfully!. and New Id is : " + ReturnIdentity;
                clsActionStatus.Return_Id = ReturnIdentity;
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Insert", "ProjectFiles", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #2
0
        /// <summary> 
        /// Update Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Update()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "ProjectId=@ProjectId,FolderId=@FolderId,FolderName=@FolderName,FNameSpace=@FNameSpace,SaveAs=@SaveAs,FullPath=@FullPath,FileData=@FileData,UserId=@UserId,isActive=@isActive,UpdatedOnUtc=getDate(),ClassType=@ClassType,isGenerated=@isGenerated";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@ProjectId", SqlDbType.Int).Value = this.ProjectId;
                myPara.Add("@FolderId", SqlDbType.Int).Value = this.FolderId;
                myPara.Add("@FolderName", SqlDbType.NVarChar).Value = this.FolderName;
                myPara.Add("@FNameSpace", SqlDbType.NVarChar).Value = this.FNameSpace;
                myPara.Add("@SaveAs", SqlDbType.NVarChar).Value = this.SaveAs;
                myPara.Add("@FullPath", SqlDbType.NVarChar).Value = this.FullPath;
                myPara.Add("@FileData", SqlDbType.NVarChar).Value = this.FileData;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;
                myPara.Add("@ClassType", SqlDbType.NVarChar).Value = this.ClassType;
                myPara.Add("@isGenerated", SqlDbType.Bit).Value = this.isGenerated;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Update", "ProjectFiles", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #3
0
        /// <summary> 
        /// Change  Record Status for active or disable but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus ChangeStatus()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "isActive=@isActive";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Status updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Change Status", "ProjectFiles", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #4
0
        /// <summary> 
        /// Delete Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Delete()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.mySqlQuery = this.getDeleteQuery(this.myTableName, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Deleted successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Delete", "ProjectFiles", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #5
0
        /// <summary> 
        /// Add New Record but first fill the properties. and Id should be 0 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Insert()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myTablesFields = "ProjectId,ActionType,MethodName,MethodFormat,MDescription,AllowSummary,SummaryFormat,SqlQueryName,SqlQueryType,ReturnType," +
                            "UserId,isActive,CreatedOnUtc,UpdatedOnUtc";
                this.myTablesFieldsValues = "@ProjectId,@ActionType,@MethodName,@MethodFormat,@MDescription,@AllowSummary,@SummaryFormat,@SqlQueryName,@SqlQueryType,@ReturnType," +
                            "@UserId,@isActive,getDate(),getDate()";
                this.mySqlQuery = this.getInsertQuery(this.myTableName, this.myTablesFields, this.myTablesFieldsValues);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@ProjectId", SqlDbType.Int).Value = this.ProjectId;
                myPara.Add("@ActionType", SqlDbType.NVarChar).Value = this.ActionType;
                myPara.Add("@MethodName", SqlDbType.NVarChar).Value = this.MethodName;
                myPara.Add("@MethodFormat", SqlDbType.NVarChar).Value = this.MethodFormat;
                myPara.Add("@MDescription", SqlDbType.NVarChar).Value = this.MDescription;
                myPara.Add("@AllowSummary", SqlDbType.Bit).Value = this.AllowSummary;
                myPara.Add("@SummaryFormat", SqlDbType.NVarChar).Value = this.SummaryFormat;
                myPara.Add("@SqlQueryName", SqlDbType.NVarChar).Value = this.SqlQueryName;
                myPara.Add("@SqlQueryType", SqlDbType.NVarChar).Value = this.SqlQueryType;
                myPara.Add("@ReturnType", SqlDbType.NVarChar).Value = this.ReturnType;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                ReturnIdentity = this.mySqlCommand.ExecuteScalar().ToString();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Created successfully!. and New Id is : " + ReturnIdentity;
                clsActionStatus.Return_Id = ReturnIdentity;
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Insert", "ProjectMethods", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #6
0
        /// <summary> 
        /// Update Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Update()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "ProjectId=@ProjectId,ActionType=@ActionType,MethodName=@MethodName,MethodFormat=@MethodFormat,MDescription=@MDescription,AllowSummary=@AllowSummary,SummaryFormat=@SummaryFormat,SqlQueryName=@SqlQueryName,SqlQueryType=@SqlQueryType,ReturnType=@ReturnType," +
                            "UserId=@UserId,isActive=@isActive,UpdatedOnUtc=getDate()";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@ProjectId", SqlDbType.Int).Value = this.ProjectId;
                myPara.Add("@ActionType", SqlDbType.NVarChar).Value = this.ActionType;
                myPara.Add("@MethodName", SqlDbType.NVarChar).Value = this.MethodName;
                myPara.Add("@MethodFormat", SqlDbType.NVarChar).Value = this.MethodFormat;
                myPara.Add("@MDescription", SqlDbType.NVarChar).Value = this.MDescription;
                myPara.Add("@AllowSummary", SqlDbType.Bit).Value = this.AllowSummary;
                myPara.Add("@SummaryFormat", SqlDbType.NVarChar).Value = this.SummaryFormat;
                myPara.Add("@SqlQueryName", SqlDbType.NVarChar).Value = this.SqlQueryName;
                myPara.Add("@SqlQueryType", SqlDbType.NVarChar).Value = this.SqlQueryType;
                myPara.Add("@ReturnType", SqlDbType.NVarChar).Value = this.ReturnType;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Update", "ProjectMethods", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #7
0
        /// <summary> 
        /// Update Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Update()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "Name=@Name,PDescription=@PDescription,UserId=@UserId,isActive=@isActive,UpdatedOnUtc=getDate()";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@Name", SqlDbType.NVarChar).Value = this.Name;
                myPara.Add("@PDescription", SqlDbType.NVarChar).Value = this.PDescription;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Update", "Methodology", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #8
0
        /// <summary> 
        /// Add New Record but first fill the properties. and Id should be 0 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Insert()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myTablesFields = "ProjectId,ParentFolderId,FolderName,FNameSpace,isCreateFolder,FDescription,UserId,isActive,CreatedOnUtc,UpdatedOnUtc";
                this.myTablesFieldsValues = "@ProjectId,@ParentFolderId,@FolderName,@FNameSpace,@isCreateFolder,@FDescription,@UserId,@isActive,getDate(),getDate()";
                this.mySqlQuery = this.getInsertQuery(this.myTableName, this.myTablesFields, this.myTablesFieldsValues);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@ProjectId", SqlDbType.Int).Value = this.ProjectId;
                myPara.Add("@ParentFolderId", SqlDbType.Int).Value = this.ParentFolderId;
                myPara.Add("@FolderName", SqlDbType.NVarChar).Value = this.FolderName;
                myPara.Add("@FNameSpace", SqlDbType.NVarChar).Value = this.FNameSpace;
                myPara.Add("@isCreateFolder", SqlDbType.Bit).Value = this.isCreateFolder;
                myPara.Add("@FDescription", SqlDbType.NVarChar).Value = this.FDescription;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                ReturnIdentity = this.mySqlCommand.ExecuteScalar().ToString();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Created successfully!. and New Id is : " + ReturnIdentity;
                clsActionStatus.Return_Id = ReturnIdentity;
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Insert", "ProjectFolders", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #9
0
        void Delete_SolutionsDB()
        {
            try
            {
                if (Messages.myDeleteMsgBox("Solutions DB", this.txtServerNamer.Text) == System.Windows.Forms.DialogResult.Yes)
                {
                    SolutionsDBDAL = new DAL.SolutionsDBDAL();
                    clsActionStatus = new clsActionStatus();

                    SolutionsDBDAL.ID = int.Parse(this.txtID.Text);

                    clsActionStatus = SolutionsDBDAL.Delete();

                    if (clsActionStatus.is_Error == false)
                    {
                        isNew_SolutionsDB = false;
                        isEdit_SolutionsDB = false;
                        Messages.DeletionMessage(clsActionStatus.Action_SuccessStatus, "Solutions DB");

                        this.SolutionsDB_bindingSource.RemoveCurrent();

                    }
                    else
                    {
                        Messages.DeletionMessage(clsActionStatus.Action_FailureStatus, "Solutions DB");
                    }

                }
            }
            catch (Exception ex)
            {
                CommonClasses.Messages.GeneralError(ex.Message, " Solutions DB");
            }
        }
예제 #10
0
        void Update_SolutionsDB()
        {
            try
            {

                SolutionsDBDAL = new DAL.SolutionsDBDAL();
                clsActionStatus = new clsActionStatus();

                SolutionsDBDAL.ID = this.txtID.Text == CommonVariables.New_IntialValue ? 0 : int.Parse(this.txtID.Text);
                SolutionsDBDAL.SolutionID = int.Parse(this.txtSolutionID.Text);
                SolutionsDBDAL.DBType = this.cmbDBType.Text;
                SolutionsDBDAL.ServerName = this.txtServerNamer.Text;
                SolutionsDBDAL.UserName = this.txtUserName.Text;
                SolutionsDBDAL.DBName = this.txtDBName.Text;
                SolutionsDBDAL.DPassword = this.txtDPassword.Text;
                SolutionsDBDAL.SQLType = this.cmbSqlType.Text;
                SolutionsDBDAL.SPFormat = this.txtSPFormat.Text;
                SolutionsDBDAL.UserId = CommonClasses.Security.UserID;
                SolutionsDBDAL.isActive = this.cbkisActive.Checked;

                if (isNew_SolutionsDB == false && isNew_SolutionsDB == false)
                {
                    Messages.Edit_New_error("Solutions DB");
                    return;
                }

                if (SolutionsDBDAL.ID > 0)
                {
                    clsActionStatus = SolutionsDBDAL.Update();
                }
                else
                {
                    clsActionStatus = SolutionsDBDAL.Insert();
                }

                if (clsActionStatus.is_Error == false)
                {
                    isNew_SolutionsDB = isEdit_SolutionsDB = false;
                    Messages.SuccessMessage(clsActionStatus.Action_SuccessStatus, "Solutions DB");

                    this.txtID.Text = clsActionStatus.Return_Id;

                    this.Solutions_bindingSource.EndEdit();

                    if (SolutionsDBDAL.ID <= 0)
                    {
                        if (Messages.myAddMore("Solutions DB") == System.Windows.Forms.DialogResult.Yes)
                        {
                            this.txtID.Focus();
                            this.New_SolutionsDB();
                        }
                    }

                }
                else
                {
                    Messages.GeneralError(clsActionStatus.Action_FailureStatus, "Solutions DB");
                }

            }
            catch (Exception ex)
            {
                CommonClasses.Messages.GeneralError(ex.Message, " Solutions DB");
            }
        }
        /// <summary> 
        /// Update Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Update()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "SolutionsDBID=@SolutionsDBID,QueryId=@QueryId,QueryName=@QueryName,TableId=@TableId,TableName=@TableName,ColumnName=@ColumnName,ColumnType=@ColumnType,ColumnDataType=@ColumnDataType,DataType=@DataType,COLUMN_KEY=@COLUMN_KEY," +
                                                "isActive=@isActive,UpdatedOnUtc=getDate()";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@SolutionsDBID", SqlDbType.Int).Value = this.SolutionsDBID;
                myPara.Add("@QueryId", SqlDbType.Int).Value = this.QueryId;
                myPara.Add("@QueryName", SqlDbType.NVarChar).Value = this.QueryName;
                myPara.Add("@TableId", SqlDbType.Int).Value = this.TableId;
                myPara.Add("@TableName", SqlDbType.NVarChar).Value = this.TableName;
                myPara.Add("@ColumnName", SqlDbType.NVarChar).Value = this.ColumnName;
                myPara.Add("@ColumnType", SqlDbType.NVarChar).Value = this.ColumnType;
                myPara.Add("@ColumnDataType", SqlDbType.NVarChar).Value = this.ColumnDataType;
                myPara.Add("@DataType", SqlDbType.NVarChar).Value = this.DataType;
                myPara.Add("@COLUMN_KEY", SqlDbType.NVarChar).Value = this.COLUMN_KEY;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Update", "SolutionsDBQueryColumns", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
        /// <summary> 
        /// Add New Record but first fill the properties. and Id should be 0 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Insert()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myTablesFields = "SolutionsDBID,QueryId,QueryName,TableId,TableName,ColumnName,ColumnType,ColumnDataType,DataType,COLUMN_KEY," +
                                        "isActive,CreatedOnUtc,UpdatedOnUtc";
                this.myTablesFieldsValues = "@SolutionsDBID,@QueryId,@QueryName,@TableId,@TableName,@ColumnName,@ColumnType,@ColumnDataType,@DataType,@COLUMN_KEY," +
                                             "@isActive,getDate(),getDate()";
                this.mySqlQuery = this.getInsertQuery(this.myTableName, this.myTablesFields, this.myTablesFieldsValues);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@SolutionsDBID", SqlDbType.Int).Value = this.SolutionsDBID;
                myPara.Add("@QueryId", SqlDbType.Int).Value = this.QueryId;
                myPara.Add("@QueryName", SqlDbType.NVarChar).Value = this.QueryName;
                myPara.Add("@TableId", SqlDbType.Int).Value = this.TableId;
                myPara.Add("@TableName", SqlDbType.NVarChar).Value = this.TableName;
                myPara.Add("@ColumnName", SqlDbType.NVarChar).Value = this.ColumnName;
                myPara.Add("@ColumnType", SqlDbType.NVarChar).Value = this.ColumnType;
                myPara.Add("@ColumnDataType", SqlDbType.NVarChar).Value = this.ColumnDataType;
                myPara.Add("@DataType", SqlDbType.NVarChar).Value = this.DataType;
                myPara.Add("@COLUMN_KEY", SqlDbType.NVarChar).Value = this.COLUMN_KEY;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;

                ReturnIdentity = this.mySqlCommand.ExecuteScalar().ToString();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Created successfully!. and New Id is : " + ReturnIdentity;
                clsActionStatus.Return_Id = ReturnIdentity;
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Insert", "SolutionsDBQueryColumns", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #13
0
        void Update_Solutions()
        {
            try
            {

                SolutionsDAL = new SolutionsDAL();
                clsActionStatus = new clsActionStatus();

                SolutionsDAL.ID = this.txtID.Text == CommonVariables.New_IntialValue ? 0 : int.Parse(this.txtID.Text);
                SolutionsDAL.SolutionName = this.txtSolutionName.Text;
                SolutionsDAL.SNameSpace = this.txtSNameSpace.Text;
                SolutionsDAL.SDescription = this.txtSDescription.Text;
                SolutionsDAL.Methodology = this.cmbMethodology.SelectedValue.ToString();
                SolutionsDAL.UserId = CommonClasses.Security.UserID;
                SolutionsDAL.isActive = this.cbkisActive.Checked;

                if (isNew_Solutions== false && isNew_Solutions == false)
                {
                    Messages.Edit_New_error("Solution");
                    return;
                }

                if (SolutionsDAL.ID > 0)
                {
                    clsActionStatus = SolutionsDAL.Update();
                }
                else
                {
                    clsActionStatus = SolutionsDAL.Insert();
                }

                if (clsActionStatus.is_Error == false)
                {
                    isNew_Solutions = isEdit_Solutions = false;
                    Messages.SuccessMessage(clsActionStatus.Action_SuccessStatus, "Solutions");

                    this.txtID.Text = clsActionStatus.Return_Id;

                    this.Solutions_bindingSource.EndEdit();

                    if (SolutionsDAL.ID <= 0)
                    {
                        if (Messages.myAddMore("Solutions") == System.Windows.Forms.DialogResult.Yes)
                        {
                            this.txtID.Focus();
                            this.New_Solutions ();
                        }
                    }

                }
                else
                {
                    Messages.GeneralError(clsActionStatus.Action_FailureStatus, "Solutions");
                }

            }
            catch (Exception ex)
            {
                CommonClasses.Messages.GeneralError(ex.Message, " Solutions");
            }
        }
예제 #14
0
        /// <summary> 
        /// Update Record but first fill the properties. and Id will be use as where condition 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Update()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myWhere = " ID=" + this.ID.ToString();
                this.myUpdateFieldsandValues = "SolutionID=@SolutionID,ProjectType=@ProjectType,ProjectName=@ProjectName,PNameSpace=@PNameSpace,PDescription=@PDescription,UserId=@UserId,isActive=@isActive,UpdatedOnUtc=getDate(),isReturnObject=@isReturnObject," +
                            "MethodNamingFormat=@MethodNamingFormat,BaseFolder=@BaseFolder";
                this.mySqlQuery = this.getUpdateQuery(this.myTableName, this.myUpdateFieldsandValues, this.myWhere);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@SolutionID", SqlDbType.Int).Value = this.SolutionID;
                myPara.Add("@ProjectType", SqlDbType.NVarChar).Value = this.ProjectType;
                myPara.Add("@ProjectName", SqlDbType.NVarChar).Value = this.ProjectName;
                myPara.Add("@PNameSpace", SqlDbType.NVarChar).Value = this.PNameSpace;
                myPara.Add("@PDescription", SqlDbType.NVarChar).Value = this.PDescription;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;
                myPara.Add("@isReturnObject", SqlDbType.Bit).Value = this.isReturnObject;
                myPara.Add("@MethodNamingFormat", SqlDbType.NVarChar).Value = this.MethodNamingFormat;

                myPara.Add("@BaseFolder", SqlDbType.NVarChar).Value = this.BaseFolder;

                this.mySqlCommand.ExecuteNonQuery();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Updated successfully!";
                clsActionStatus.Return_Id = this.ID.ToString();
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Update", "Projects", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }
예제 #15
0
        /// <summary> 
        /// Add New Record but first fill the properties. and Id should be 0 
        /// </summary> 
        /// <returns></returns> 
        public clsActionStatus Insert()
        {
            clsActionStatus clsActionStatus = new clsActionStatus();

            try
            {
                this.myTablesFields = "SolutionID,ProjectType,ProjectName,PNameSpace,PDescription,UserId,isActive,CreatedOnUtc,UpdatedOnUtc,isReturnObject," +
                            "MethodNamingFormat,BaseFolder";
                this.myTablesFieldsValues = "@SolutionID,@ProjectType,@ProjectName,@PNameSpace,@PDescription,@UserId,@isActive,getDate(),getDate(),@isReturnObject," +
                            "@MethodNamingFormat,@BaseFolder";
                this.mySqlQuery = this.getInsertQuery(this.myTableName, this.myTablesFields, this.myTablesFieldsValues);
                this.mySqlCommand = new SqlCommand(this.mySqlQuery, this.getSQLConnection());
                var myPara = this.mySqlCommand.Parameters;

                myPara.Add("@SolutionID", SqlDbType.Int).Value = this.SolutionID;
                myPara.Add("@ProjectType", SqlDbType.NVarChar).Value = this.ProjectType;
                myPara.Add("@ProjectName", SqlDbType.NVarChar).Value = this.ProjectName;
                myPara.Add("@PNameSpace", SqlDbType.NVarChar).Value = this.PNameSpace;
                myPara.Add("@PDescription", SqlDbType.NVarChar).Value = this.PDescription;
                myPara.Add("@UserId", SqlDbType.Int).Value = this.UserId;
                myPara.Add("@isActive", SqlDbType.Bit).Value = this.isActive;
                myPara.Add("@isReturnObject", SqlDbType.Bit).Value = this.isReturnObject;
                myPara.Add("@MethodNamingFormat", SqlDbType.NVarChar).Value = this.MethodNamingFormat;

                myPara.Add("@BaseFolder", SqlDbType.NVarChar).Value = this.BaseFolder;

                ReturnIdentity = this.mySqlCommand.ExecuteScalar().ToString();
                clsActionStatus.is_Error = false;
                clsActionStatus.Action_SuccessStatus = "Record Created successfully!. and New Id is : " + ReturnIdentity;
                clsActionStatus.Return_Id = ReturnIdentity;
            }
            catch (SqlException ex)
            {
                clsActionStatus.is_Error = true;
                clsActionStatus.Action_FailureStatus = this.Error_Description("Insert", "Projects", ex.ErrorCode.ToString(), ex.Message);
            }
            finally
            {
                this.mySqlCommand.Dispose();
                this.CloseSqlConnection();
            }
            return clsActionStatus;
        }